*switch to pino logger
This commit is contained in:
parent
f597afac6a
commit
3fffc08d54
|
@ -31,7 +31,6 @@
|
|||
"ajv": "^8.11.0",
|
||||
"async-mutex": "^0.3.2",
|
||||
"b4a": "^1.6.1",
|
||||
"chalk": "4.1.2",
|
||||
"compact-encoding": "^2.11.0",
|
||||
"date-fns": "^2.28.0",
|
||||
"dotenv": "^16.0.1",
|
||||
|
@ -44,13 +43,14 @@
|
|||
"json-stringify-deterministic": "^1.0.7",
|
||||
"loady": "https://github.com/LumeWeb/loady.git",
|
||||
"loglevel": "^1.8.1",
|
||||
"loglevel-plugin-prefix": "^0.8.4",
|
||||
"micro-ed25519-hdkey": "^0.1.2",
|
||||
"msgpackr": "^1.6.1",
|
||||
"node-cache": "^5.1.2",
|
||||
"node-cron": "^3.0.1",
|
||||
"node-fetch": "2",
|
||||
"p-timeout": "https://git.lumeweb.com/LumeWeb/p-timeout.git",
|
||||
"pino": "^8.8.0",
|
||||
"pino-pretty": "^9.1.1",
|
||||
"promise-retry": "^2.0.1",
|
||||
"protomux": "^3.4.0",
|
||||
"protomux-rpc": "^1.3.0",
|
||||
|
|
|
@ -3,9 +3,7 @@ import Config from "@lumeweb/cfg";
|
|||
import * as os from "os";
|
||||
import * as fs from "fs";
|
||||
import path from "path";
|
||||
import log from "loglevel";
|
||||
import chalk, { Chalk } from "chalk";
|
||||
import prefix from "loglevel-plugin-prefix";
|
||||
import { log } from "./log.js";
|
||||
|
||||
const config = new Config("lumeweb-relay");
|
||||
|
||||
|
@ -53,25 +51,6 @@ config.load({
|
|||
argv: true,
|
||||
});
|
||||
|
||||
log.setDefaultLevel(config.get("loglevel"));
|
||||
|
||||
const colors = {
|
||||
TRACE: chalk.magenta,
|
||||
DEBUG: chalk.cyan,
|
||||
INFO: chalk.blue,
|
||||
WARN: chalk.yellow,
|
||||
ERROR: chalk.red,
|
||||
} as { [level: string]: Chalk };
|
||||
|
||||
prefix.reg(log);
|
||||
log.enableAll();
|
||||
|
||||
prefix.apply(log, {
|
||||
format(level, name, timestamp) {
|
||||
return `${chalk.gray(`[${timestamp}]`)} ${colors[level.toUpperCase()](
|
||||
level
|
||||
)} ${chalk.green(`${name}:`)}`;
|
||||
},
|
||||
});
|
||||
log.level = config.get("loglevel");
|
||||
|
||||
export default config;
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
import pino from "pino";
|
||||
import pretty from "pino-pretty";
|
||||
|
||||
const stream = pretty({
|
||||
colorize: true,
|
||||
});
|
||||
|
||||
export const log = pino(stream);
|
99
yarn.lock
99
yarn.lock
|
@ -684,7 +684,6 @@ __metadata:
|
|||
ajv: "npm:^8.11.0"
|
||||
async-mutex: "npm:^0.3.2"
|
||||
b4a: "npm:^1.6.1"
|
||||
chalk: "npm:4.1.2"
|
||||
cli-progress: "npm:^3.11.2"
|
||||
compact-encoding: "npm:^2.11.0"
|
||||
date-fns: "npm:^2.28.0"
|
||||
|
@ -699,7 +698,6 @@ __metadata:
|
|||
json-stringify-deterministic: "npm:^1.0.7"
|
||||
loady: "https://github.com/LumeWeb/loady.git"
|
||||
loglevel: "npm:^1.8.1"
|
||||
loglevel-plugin-prefix: "npm:^0.8.4"
|
||||
micro-ed25519-hdkey: "npm:^0.1.2"
|
||||
msgpackr: "npm:^1.6.1"
|
||||
node-cache: "npm:^5.1.2"
|
||||
|
@ -707,6 +705,8 @@ __metadata:
|
|||
node-fetch: "npm:2"
|
||||
node-gyp: "npm:^9.1.0"
|
||||
p-timeout: "https://git.lumeweb.com/LumeWeb/p-timeout.git"
|
||||
pino: "npm:^8.8.0"
|
||||
pino-pretty: "npm:^9.1.1"
|
||||
pkg: "npm:^5.8.0"
|
||||
prebuildify: "npm:^5.0.1"
|
||||
prettier: "npm:^2.7.1"
|
||||
|
@ -1377,7 +1377,7 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"chalk@npm:4.1.2, chalk@npm:^4.1.2":
|
||||
"chalk@npm:^4.1.2":
|
||||
version: 4.1.2
|
||||
resolution: "chalk@npm:4.1.2"
|
||||
dependencies:
|
||||
|
@ -1467,6 +1467,13 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"colorette@npm:^2.0.7":
|
||||
version: 2.0.19
|
||||
resolution: "colorette@npm:2.0.19"
|
||||
checksum: f887e4f7608a1a37037f0b9f7da4d1608e2e1ac0126b87c4c143ff0348bc586173b86fde37f71f1b7742cd1c04285d0cb3cbeab391935886c86a162f4f2b5b87
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"combined-stream@npm:^1.0.8":
|
||||
version: 1.0.8
|
||||
resolution: "combined-stream@npm:1.0.8"
|
||||
|
@ -1552,6 +1559,13 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"dateformat@npm:^4.6.3":
|
||||
version: 4.6.3
|
||||
resolution: "dateformat@npm:4.6.3"
|
||||
checksum: 5db2adb3677e2e2c48d5c783a9f4c8e3418906108f99c821f10a8d029601307fcc88e0fff593360ca77ba05939335666834e68282a10e539c017c0f9a933870e
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"debug@npm:4, debug@npm:^4.0.0, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.3":
|
||||
version: 4.3.4
|
||||
resolution: "debug@npm:4.3.4"
|
||||
|
@ -1790,6 +1804,13 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"fast-copy@npm:^3.0.0":
|
||||
version: 3.0.0
|
||||
resolution: "fast-copy@npm:3.0.0"
|
||||
checksum: f03630cf09ef5236d44340875a7e51d0521f42b25147763e6b9056c57f5ccec278d099ef23885dc4eeae2cb9963296ec2f43eaa91b1b8ae9db3ace9c666c69ba
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"fast-decode-uri-component@npm:^1.0.1":
|
||||
version: 1.0.1
|
||||
resolution: "fast-decode-uri-component@npm:1.0.1"
|
||||
|
@ -1854,6 +1875,13 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"fast-safe-stringify@npm:^2.1.1":
|
||||
version: 2.1.1
|
||||
resolution: "fast-safe-stringify@npm:2.1.1"
|
||||
checksum: 7a11ba04c533022b3b1155c5764b0b160489dda848f2346969179527559dc3f1c10e18b7181fa9a7c3ad3dd05f3fda6b8806ee7b212959c97d6036d06d38cf17
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"fast-uri@npm:^2.0.0, fast-uri@npm:^2.1.0":
|
||||
version: 2.2.0
|
||||
resolution: "fast-uri@npm:2.2.0"
|
||||
|
@ -2109,7 +2137,7 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"glob@npm:^8.0.1":
|
||||
"glob@npm:^8.0.0, glob@npm:^8.0.1":
|
||||
version: 8.0.3
|
||||
resolution: "glob@npm:8.0.3"
|
||||
dependencies:
|
||||
|
@ -2176,6 +2204,16 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"help-me@npm:^4.0.1":
|
||||
version: 4.2.0
|
||||
resolution: "help-me@npm:4.2.0"
|
||||
dependencies:
|
||||
glob: "npm:^8.0.0"
|
||||
readable-stream: "npm:^3.6.0"
|
||||
checksum: a6760f884b81ce494799955bf93e5d4ff6946d168c2526658c5f994c2f6e86d0cc4e5c5f394d0744fb5351cd5195c5ae57acb5c3bc1bab116fca392106841389
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"hmac-blake2b@npm:^2.0.0":
|
||||
version: 2.0.0
|
||||
resolution: "hmac-blake2b@npm:2.0.0"
|
||||
|
@ -2444,6 +2482,13 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"joycon@npm:^3.1.1":
|
||||
version: 3.1.1
|
||||
resolution: "joycon@npm:3.1.1"
|
||||
checksum: a51b680763b484e3bc516a33e959db12fb61fa8f58130e060151e8412607256b3647d97d5a16e66bd990d8a4a319a36b185af3f119340c4362c06faf38900d08
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"js-sha3@npm:0.8.0":
|
||||
version: 0.8.0
|
||||
resolution: "js-sha3@npm:0.8.0"
|
||||
|
@ -2554,13 +2599,6 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"loglevel-plugin-prefix@npm:^0.8.4":
|
||||
version: 0.8.4
|
||||
resolution: "loglevel-plugin-prefix@npm:0.8.4"
|
||||
checksum: 92ceb5d7cce5486c94a0eea908be16120dc8d93320fd14afd14fff99f90ca86aff276dbc6cf7423039189b712ea8768759f1d9181cbd757502073c23f2b00a63
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"loglevel@npm:^1.8.1":
|
||||
version: 1.8.1
|
||||
resolution: "loglevel@npm:1.8.1"
|
||||
|
@ -3178,7 +3216,7 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"pino-abstract-transport@npm:v1.0.0":
|
||||
"pino-abstract-transport@npm:^1.0.0, pino-abstract-transport@npm:v1.0.0":
|
||||
version: 1.0.0
|
||||
resolution: "pino-abstract-transport@npm:1.0.0"
|
||||
dependencies:
|
||||
|
@ -3188,6 +3226,30 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"pino-pretty@npm:^9.1.1":
|
||||
version: 9.1.1
|
||||
resolution: "pino-pretty@npm:9.1.1"
|
||||
dependencies:
|
||||
colorette: "npm:^2.0.7"
|
||||
dateformat: "npm:^4.6.3"
|
||||
fast-copy: "npm:^3.0.0"
|
||||
fast-safe-stringify: "npm:^2.1.1"
|
||||
help-me: "npm:^4.0.1"
|
||||
joycon: "npm:^3.1.1"
|
||||
minimist: "npm:^1.2.6"
|
||||
on-exit-leak-free: "npm:^2.1.0"
|
||||
pino-abstract-transport: "npm:^1.0.0"
|
||||
pump: "npm:^3.0.0"
|
||||
readable-stream: "npm:^4.0.0"
|
||||
secure-json-parse: "npm:^2.4.0"
|
||||
sonic-boom: "npm:^3.0.0"
|
||||
strip-json-comments: "npm:^3.1.1"
|
||||
bin:
|
||||
pino-pretty: bin.js
|
||||
checksum: 1822e0ca3b711e34c279373ff168dcde092765f1f317a1255b7dbc11621a815791c168c1f0d51bbd23c3565b50dfeb776480c178d37a6f3aa92f9fe89eec710b
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"pino-std-serializers@npm:^6.0.0":
|
||||
version: 6.0.0
|
||||
resolution: "pino-std-serializers@npm:6.0.0"
|
||||
|
@ -3195,7 +3257,7 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"pino@npm:^8.5.0":
|
||||
"pino@npm:^8.5.0, pino@npm:^8.8.0":
|
||||
version: 8.8.0
|
||||
resolution: "pino@npm:8.8.0"
|
||||
dependencies:
|
||||
|
@ -3691,7 +3753,7 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"secure-json-parse@npm:^2.5.0":
|
||||
"secure-json-parse@npm:^2.4.0, secure-json-parse@npm:^2.5.0":
|
||||
version: 2.6.0
|
||||
resolution: "secure-json-parse@npm:2.6.0"
|
||||
checksum: 5459182cffb6d7c304545e825cc0fbc565633cda48099857454dac49fdabac1a1ab263764c01435bdf234e57275ecdbd9dc402a4830858f0fed8f9a0bc6d3aa5
|
||||
|
@ -3919,7 +3981,7 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"sonic-boom@npm:^3.1.0":
|
||||
"sonic-boom@npm:^3.0.0, sonic-boom@npm:^3.1.0":
|
||||
version: 3.2.1
|
||||
resolution: "sonic-boom@npm:3.2.1"
|
||||
dependencies:
|
||||
|
@ -4021,6 +4083,13 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"strip-json-comments@npm:^3.1.1":
|
||||
version: 3.1.1
|
||||
resolution: "strip-json-comments@npm:3.1.1"
|
||||
checksum: 20cff3f15267a8b603c4dcec9c3cc5217bcf3f1a66481a4f9ecf262eacc1733a0457756288472328d24efef7705f7755e9511f9c383742389add93d4a9207ae5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"strip-json-comments@npm:~2.0.1":
|
||||
version: 2.0.1
|
||||
resolution: "strip-json-comments@npm:2.0.1"
|
||||
|
|
Loading…
Reference in New Issue