@things-factory/env 7.0.0-alpha.24 → 7.0.0-alpha.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/logger.js +0 -10
- package/package.json +2 -3
- package/lib/winston-raygun.js +0 -26
package/lib/logger.js
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
const Raygun = require('./winston-raygun')
|
2
1
|
const moment = require('moment-timezone')
|
3
2
|
|
4
3
|
var config = require('./config')
|
@@ -8,7 +7,6 @@ require('winston-daily-rotate-file')
|
|
8
7
|
const { combine, timestamp, splat, simple, printf } = format
|
9
8
|
|
10
9
|
var { file: fileConfig, console: consoleConfig } = config.get('logger', {})
|
11
|
-
var { apiKey: RaygunApiKey } = config.get('raygun', {})
|
12
10
|
|
13
11
|
var logTransports = []
|
14
12
|
|
@@ -31,14 +29,6 @@ if (consoleConfig) {
|
|
31
29
|
logTransports.push(new transports.Console(Object.assign({}, CONSOLE_LOGGER_CONFIG, consoleConfig)))
|
32
30
|
}
|
33
31
|
|
34
|
-
if (RaygunApiKey) {
|
35
|
-
logTransports.push(
|
36
|
-
new Raygun({
|
37
|
-
apiKey: RaygunApiKey
|
38
|
-
})
|
39
|
-
)
|
40
|
-
}
|
41
|
-
|
42
32
|
const SYSTEM_TZ = Intl.DateTimeFormat().resolvedOptions().timeZone
|
43
33
|
const systemTimestamp = format((info, opts) => {
|
44
34
|
if (opts.tz) info.timestamp = moment().tz(opts.tz).format()
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@things-factory/env",
|
3
|
-
"version": "7.0.0-alpha.
|
3
|
+
"version": "7.0.0-alpha.30",
|
4
4
|
"description": "Things Factory running environment helper library",
|
5
5
|
"main": "index.js",
|
6
6
|
"author": "heartyoh@hatiolab.com",
|
@@ -23,10 +23,9 @@
|
|
23
23
|
"fs-extra": "^9.0.1",
|
24
24
|
"loader-utils": "^1.2.3",
|
25
25
|
"moment-timezone": "^0.5.40",
|
26
|
-
"raygun": "^0.13.2",
|
27
26
|
"schema-utils": "^1.0.0",
|
28
27
|
"winston": "^3.2.1",
|
29
28
|
"winston-daily-rotate-file": "^4.2.1"
|
30
29
|
},
|
31
|
-
"gitHead": "
|
30
|
+
"gitHead": "64f2ff6e284ecb26530d1a456a0627dced03fde7"
|
32
31
|
}
|
package/lib/winston-raygun.js
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
const Transport = require('winston-transport')
|
2
|
-
const raygun = require('raygun')
|
3
|
-
|
4
|
-
module.exports = class Raygun extends Transport {
|
5
|
-
constructor(opts) {
|
6
|
-
super(opts)
|
7
|
-
|
8
|
-
var opts = opts || {}
|
9
|
-
this.name = 'raygun'
|
10
|
-
this.apiKey = opts.apiKey
|
11
|
-
|
12
|
-
this.raygunClient = opts.raygunClient || new raygun.Client().init({ apiKey: this.apiKey })
|
13
|
-
}
|
14
|
-
|
15
|
-
log(info, callback) {
|
16
|
-
setImmediate(() => {
|
17
|
-
this.emit('logged', info)
|
18
|
-
})
|
19
|
-
|
20
|
-
if (info.level === 'error') {
|
21
|
-
return this.raygunClient.send(info)
|
22
|
-
}
|
23
|
-
|
24
|
-
callback()
|
25
|
-
}
|
26
|
-
}
|