@fonoster/logger 0.4.10 → 0.4.12

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/dist/envs.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import winston from "winston";
2
+ declare const LOGS_LEVEL: string;
2
3
  declare const fluent: any;
3
4
  declare const format: winston.Logform.Format;
4
- declare const level: string;
5
5
  declare const transports: any[];
6
- export { format, level, transports, fluent };
6
+ export { format, LOGS_LEVEL as level, transports, fluent };
package/dist/envs.js CHANGED
@@ -25,20 +25,23 @@ exports.fluent = exports.transports = exports.level = exports.format = void 0;
25
25
  const winston_1 = __importDefault(require("winston"));
26
26
  const fluent_logger_1 = __importDefault(require("fluent-logger"));
27
27
  const fluentTransport = fluent_logger_1.default.support.winstonTransport();
28
- const fluent = new fluentTransport(`${process.env.LOGS_OPT_TAG_PREFIX}`, {
29
- host: process.env.LOGS_DRIVER_HOST,
30
- port: process.env.LOGS_DRIVER_PORT,
28
+ const LOGS_DRIVER_HOST = process.env.LOGS_DRIVER_HOST;
29
+ const LOGS_DRIVER_PORT = process.env.LOGS_DRIVER_PORT || 24224;
30
+ const LOGS_OPT_TAG_PREFIX = process.env.LOGS_OPT_TAG_PREFIX || "fonoster-logs";
31
+ const LOGS_FORMAT = process.env.LOGS_FORMAT || "json";
32
+ const LOGS_LEVEL = process.env.LOGS_LEVEL || "info";
33
+ exports.level = LOGS_LEVEL;
34
+ const LOGS_TRANSPORT = process.env.LOGS_TRANSPORT || "fluent";
35
+ const fluent = new fluentTransport(`${LOGS_OPT_TAG_PREFIX}`, {
36
+ host: LOGS_DRIVER_HOST,
37
+ port: LOGS_DRIVER_PORT,
31
38
  timeout: 3.0,
32
39
  requireAckResponse: false
33
40
  });
34
41
  exports.fluent = fluent;
35
- const format = process.env.LOGS_FORMAT === "json"
42
+ const format = LOGS_FORMAT === "json"
36
43
  ? winston_1.default.format.combine(winston_1.default.format.timestamp(), winston_1.default.format.json())
37
44
  : winston_1.default.format.combine(winston_1.default.format.colorize(), winston_1.default.format.simple());
38
45
  exports.format = format;
39
- const level = process.env.LOGS_LEVEL ? process.env.LOGS_LEVEL : "info";
40
- exports.level = level;
41
- const transports = process.env.LOGS_TRANSPORT === "fluent"
42
- ? [fluent]
43
- : [new winston_1.default.transports.Console()];
46
+ const transports = LOGS_TRANSPORT === "fluent" ? [fluent] : [new winston_1.default.transports.Console()];
44
47
  exports.transports = transports;
@@ -27,7 +27,7 @@ const envs_1 = require("./envs");
27
27
  const winston_1 = __importDefault(require("winston"));
28
28
  const loggers = new Map();
29
29
  const getLogger = (config) => {
30
- const key = config.service || 'default';
30
+ const key = config.service || "default";
31
31
  if (loggers.has(key)) {
32
32
  return loggers.get(key);
33
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fonoster/logger",
3
- "version": "0.4.10",
3
+ "version": "0.4.12",
4
4
  "description": "Logger module",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/fonoster#readme",
@@ -37,5 +37,5 @@
37
37
  "rimraf": "^3.0.2",
38
38
  "typescript": "^4.1.3"
39
39
  },
40
- "gitHead": "5803a7dc72afe7bf454896ae4c60c7565d27eb49"
40
+ "gitHead": "85d2c5384d83041dc22bd0362b2022a016a64bfb"
41
41
  }