Repository URL to install this package:
|
Version:
0.8.2 ▾
|
// (c) Copyright 2023 Supertenant Ltd. - all rights reserved.
// See LICENSE file in project root for license terms.
"use strict";const http=require("@supertenant/core").uninstrumentedHttp["http"],agentOpts=require("./opts");function swallow(){}module.exports=function(logLevel,message,stackTrace){message={m:message.trim()},stackTrace&&(message.st=stackTrace.trim()),stackTrace=Buffer.from(JSON.stringify(message),"utf8"),message=http.request({host:agentOpts.host,port:agentOpts.port,path:"/com.instana.agent.logger",method:"POST",agent:http.agent,headers:{"Content-Type":"application/json; charset=UTF-8","Content-Length":stackTrace.length,"x-log-level":logLevel}},res=>{res.resume()});message.setTimeout(agentOpts.requestTimeout,swallow),message.on("error",swallow),message.write(stackTrace),message.end()};