@golemio/validator 0.2.4 → 0.2.5-dev.695207902

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/README.md CHANGED
@@ -51,9 +51,9 @@ import { Validator } from "@golemio/validator";
51
51
 
52
52
  ## Logging
53
53
 
54
- Logging uses `Winston` for standard logging with levels and `debug` (https://www.npmjs.com/package/debug) for debugging.
54
+ Logging uses `pino` for standard logging with levels and `debug` (https://www.npmjs.com/package/debug) for debugging.
55
55
 
56
- All logs with `silly` and `debug` level are printed as standard log (if appropriate log level is set) using Winston as well as using `debug` module with `"golemio:validator"` settings.
56
+ All logs with `silly` and `debug` level are printed as standard log (if appropriate log level is set) using `pino` as well as using `debug` module with `"golemio:validator"` settings.
57
57
 
58
58
  You can set both `LOG_LEVEL` and `DEBUG` settings in ENV variables.
59
59
 
package/dist/Logger.d.ts CHANGED
@@ -1,10 +1,9 @@
1
- import * as winston from "winston";
2
- export interface ILogger {
3
- error: winston.LeveledLogMethod;
4
- warn: winston.LeveledLogMethod;
5
- info: winston.LeveledLogMethod;
6
- debug: (formatter: any, ...args: any[]) => void;
7
- silly: (formatter: any, ...args: any[]) => void;
8
- }
1
+ import pino from "pino";
2
+ export declare type ILogger = pino.Logger<{
3
+ customLevels: {
4
+ verbose: number;
5
+ silly: number;
6
+ };
7
+ }>;
9
8
  declare const logger: ILogger;
10
9
  export { logger as log };
package/dist/Logger.js CHANGED
@@ -1,38 +1,36 @@
1
1
  "use strict";
2
+ var _a;
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.log = void 0;
4
- /// Setup for logger - uses Winston logger for standard logging output and debug module for debugging logs
5
- const config_1 = require("./config");
6
5
  const debug = require("debug");
7
- const winston = require("winston");
8
- const debugLog = debug("golemio:validator");
9
- /**
10
- * Sets up a Winston logger format - https://www.npmjs.com/package/winston#formats
11
- */
12
- const logFormat = (info) => {
13
- return `[${info.timestamp}] [${info.level}]: ${info.message}`;
14
- };
15
- const logLevelToSet = config_1.default.log_level ? config_1.default.log_level.toLowerCase() : "info";
16
- /**
17
- * Winston logger setup
18
- */
19
- const setFormat = winston.format.combine(winston.format.timestamp(), winston.format.colorize(), winston.format.align(), winston.format.printf(logFormat));
20
- const winstonLogger = winston.createLogger({
21
- format: setFormat,
22
- transports: [new winston.transports.Console({ level: logLevelToSet })],
6
+ const pino_1 = require("pino");
7
+ const config_1 = require("./config");
8
+ const logger = (0, pino_1.default)({
9
+ level: ((_a = config_1.default.log_level) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || "info",
10
+ customLevels: {
11
+ silly: 5,
12
+ verbose: 25,
13
+ },
14
+ base: undefined,
15
+ formatters: {
16
+ level: (label) => {
17
+ return { level: label };
18
+ },
19
+ },
20
+ errorKey: "error",
21
+ messageKey: "message",
22
+ timestamp: pino_1.default.stdTimeFunctions.isoTime,
23
23
  });
24
- const logger = winstonLogger;
25
24
  exports.log = logger;
26
- const winstonDebugLog = logger.debug;
27
- const winstonSillyLog = logger.silly;
28
- // Log all "SILLY" logs also to debug module
29
- logger.silly = (formatter, ...args) => {
30
- debugLog(formatter, args);
31
- winstonSillyLog(formatter);
25
+ const loggerDebugLog = logger.debug.bind(logger);
26
+ const loggerSillyLog = logger.silly.bind(logger);
27
+ const debugLog = debug("golemio:validator");
28
+ logger.silly = (...args) => {
29
+ debugLog.apply(null, args);
30
+ loggerSillyLog.apply(null, args);
32
31
  };
33
- // Log all "DEBUG" logs also to debug module
34
- logger.debug = (formatter, ...args) => {
35
- debugLog(formatter, args);
36
- winstonDebugLog(formatter);
32
+ logger.debug = (...args) => {
33
+ debugLog.apply(null, args);
34
+ loggerDebugLog.apply(null, args);
37
35
  };
38
36
  //# sourceMappingURL=Logger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Logger.js","sourceRoot":"","sources":["../src/Logger.ts"],"names":[],"mappings":";;;AAAA,0GAA0G;AAC1G,qCAA8B;AAE9B,+BAA+B;AAE/B,mCAAmC;AAEnC,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IAAI,EAAE,IAAI,CAAC,CAAC;IAC3B,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACrC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/validator",
3
- "version": "0.2.4",
3
+ "version": "0.2.5-dev.695207902",
4
4
  "description": "Library of Validator classes of the Golemio Data Platform System",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -29,7 +29,6 @@
29
29
  "@types/mocha": "^5.2.5",
30
30
  "@types/node": "^14.17.15",
31
31
  "@types/sinon": "^7.0.13",
32
- "@types/winston": "^2.4.4",
33
32
  "chai": "^4.2.0",
34
33
  "chai-as-promised": "^7.1.1",
35
34
  "eslint": "^8.13.0",
@@ -47,11 +46,10 @@
47
46
  "debug": "^4.1.1",
48
47
  "dotenv": "^8.0.0",
49
48
  "mongoose": "^6.5.3",
50
- "winston": "^3.2.1"
49
+ "pino": "^8.7.0"
51
50
  },
52
51
  "resolutions": {
53
- "minimist": "^1.2.6",
54
- "winston": "^3.2.2"
52
+ "minimist": "^1.2.6"
55
53
  },
56
54
  "nyc": {
57
55
  "check-coverage": true,