Sends a JSON POST request with LogMessage
in the body to the specified url.
log.transports.remote.level = 'warn';
log.transports.remote.url = 'https://example.com/myapp/add-log'
log.warn('Some problem appears', { error: e });
The code above produces the following HTTP request (json is formatted for clarity in the example):
POST /myapp/add-log HTTP/1.1
Content-Length: 300
Content-Type: application/json
Host: example.com
Connection: close
{
"client": { "name": "electron-application" },
"data": [
"Some problem appears",
{
"error": {
"constructor": "Error",
"stack": "Error: test\n at App.createWindow ..."
}
}
],
"date": 1574238042989,
"level": "warn",
"variables": { "processType": "browser" }
}
Default: { name: 'electron-application' }
It's just an additional field which will be appended to JSON body for each request.
Default: 6
Sometimes logging very complex object can produce a huge POST body. To reduce
request size set depth option to exclude nested objects which are deeper than
depth
.
Default: false
Filter log messages which can be sent via the transport.
A callback which makes a POST body from a message
A callback called on request error
Default: {}
Customize options used by
http.request()
Default: undefined
Endpoint URL.