chatbot-nc 2.0.40 → 2.0.42

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.
@@ -6,6 +6,7 @@ import BaseDynamoDBRepository from "./repository/dynamodb";
6
6
  import BaseCommunicationService from "./communication";
7
7
  import { HashService } from "./hashing";
8
8
  import hashids from "./hashing/idObfuscation";
9
+ import log from "./logger";
9
10
  import UrlService from "./shortner";
10
11
  import { Utils } from "./utils";
11
- export { AWS, axios, ENUM, Utils, BaseCommunicationService, WebHookEvent, BaseDynamoDBRepository, HashService, UrlService, hashids };
12
+ export { AWS, axios, ENUM, Utils, BaseCommunicationService, WebHookEvent, BaseDynamoDBRepository, HashService, UrlService, hashids, log };
package/dist/cjs/index.js CHANGED
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.hashids = exports.UrlService = exports.HashService = exports.BaseDynamoDBRepository = exports.WebHookEvent = exports.BaseCommunicationService = exports.Utils = exports.ENUM = exports.axios = exports.AWS = void 0;
29
+ exports.log = exports.hashids = exports.UrlService = exports.HashService = exports.BaseDynamoDBRepository = exports.WebHookEvent = exports.BaseCommunicationService = exports.Utils = exports.ENUM = exports.axios = exports.AWS = void 0;
30
30
  const aws_1 = require("./aws");
31
31
  Object.defineProperty(exports, "AWS", { enumerable: true, get: function () { return aws_1.AWS; } });
32
32
  const axios_1 = __importDefault(require("axios"));
@@ -43,6 +43,8 @@ const hashing_1 = require("./hashing");
43
43
  Object.defineProperty(exports, "HashService", { enumerable: true, get: function () { return hashing_1.HashService; } });
44
44
  const idObfuscation_1 = __importDefault(require("./hashing/idObfuscation"));
45
45
  exports.hashids = idObfuscation_1.default;
46
+ const logger_1 = __importDefault(require("./logger"));
47
+ exports.log = logger_1.default;
46
48
  const shortner_1 = __importDefault(require("./shortner"));
47
49
  exports.UrlService = shortner_1.default;
48
50
  const utils_1 = require("./utils");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA4B;AAYzB,oFAZM,SAAG,OAYN;AAXN,kDAAyB;AAYtB,gBAZI,eAAK,CAYJ;AAXR,6CAA+B;AAY5B,oBAAI;AAXP,kEAA0C;AAcvC,uBAdI,sBAAY,CAcJ;AAbf,qEAA2D;AAcxD,iCAdI,kBAAsB,CAcJ;AAbzB,oEAAuD;AAWpD,mCAXI,uBAAwB,CAWJ;AAV3B,uCAAwC;AAarC,4FAbM,qBAAW,OAaN;AAZd,4EAA8C;AAc3C,kBAdI,uBAAO,CAcJ;AAbV,0DAAoC;AAYjC,qBAZI,kBAAU,CAYJ;AAXb,mCAAgC;AAM7B,sFANM,aAAK,OAMN"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA4B;AAazB,oFAbM,SAAG,OAaN;AAZN,kDAAyB;AAatB,gBAbI,eAAK,CAaJ;AAZR,6CAA+B;AAa5B,oBAAI;AAZP,kEAA0C;AAevC,uBAfI,sBAAY,CAeJ;AAdf,qEAA2D;AAexD,iCAfI,kBAAsB,CAeJ;AAdzB,oEAAuD;AAYpD,mCAZI,uBAAwB,CAYJ;AAX3B,uCAAwC;AAcrC,4FAdM,qBAAW,OAcN;AAbd,4EAA8C;AAe3C,kBAfI,uBAAO,CAeJ;AAdV,sDAA2B;AAexB,cAfI,gBAAG,CAeJ;AAdN,0DAAoC;AAYjC,qBAZI,kBAAU,CAYJ;AAXb,mCAAgC;AAM7B,sFANM,aAAK,OAMN"}
@@ -0,0 +1,3 @@
1
+ import winston from "winston";
2
+ declare let log: winston.Logger;
3
+ export default log;
@@ -1,73 +1,80 @@
1
1
  "use strict";
2
- // import winston from "winston";
3
- // const config = require('./loggerTransports');
4
- // export default class Logger {
5
- // getLogger(module) {
6
- // const logType = process.env.LOG_TYPE || 'console';
7
- // const level = process.env.LOG_LEVEL || "info";
8
- // let logger;
9
- // console.log(logType);
10
- // switch (logType) {
11
- // case 'off':
12
- // console.log('Logging is off');
13
- // logger = winston.createLogger(config.offTransport());
14
- // logger.cli();
15
- // break;
16
- // case 'console':
17
- // console.log('***********Logging to console***********');
18
- // logger = winston.createLogger(config.consoleTransport());
19
- // logger.format = winston.format.combine(winston.format.colorize(), winston.format.simple())
20
- // break;
21
- // case 'aws':
22
- // console.log('***********Logging to aws****************');
23
- // logger = winston.createLogger(config.awsTransport(module));
24
- // break;
25
- // case 'file':
26
- // console.log('***********Logging to file****************');
27
- // logger = winston.createLogger(config.fileTransport());
28
- // break;
29
- // default:
30
- // console.log('***********Default chosen:Logging to console***********');
31
- // logger = (config.consoleTransport());
32
- // logger.cli();
33
- // break;
34
- // }
35
- // logger.level = level;
36
- // logger.format = this.getRequestLogFormatter();
37
- // // Call exceptions.handle with a transport to handle exceptions
38
- // // logger.exceptions.handle(
39
- // // new winston.transports.File({ filename: 'exceptions.log' })
40
- // // );
41
- // /* const DailyRotateFile = require('winston-daily-rotate-file');
42
- // logger.configure({
43
- // level: 'verbose',
44
- // transports: [
45
- // new DailyRotateFile(opts)
46
- // ]
47
- // });*/
48
- // logger.exitOnError = false; //winston will not exit after logging an uncaughtException
49
- // return logger;
50
- // }
51
- // getRequestLogFormatter() {
52
- // const { combine, timestamp, printf } = winston.format;
53
- // return combine(
54
- // timestamp({
55
- // format: 'YYYY-MM-DD HH:mm:ss'
56
- // }),
57
- // // [${info.label}] winston.format.label({ label: path.basename(process.mainModule.filename) }),
58
- // winston.format.printf(info => `${info.timestamp} ${info.level} : ${info.message}`)
59
- // );
60
- // }
61
- // logError(err, req, res, next) {
62
- // logger.error(err)
63
- // next();
64
- // }
65
- // logRequest(req, res, next, log) {
66
- // log.info('hello');
67
- // next();
68
- // }
69
- // getLog() {
70
- // return this.logger;
71
- // }
72
- // }
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const winston_1 = __importDefault(require("winston"));
16
+ const loggerTransports_1 = require("./loggerTransports");
17
+ class Logger {
18
+ constructor() {
19
+ this.logger = new winston_1.default.Logger((0, loggerTransports_1.consoleTransport)());
20
+ (() => __awaiter(this, void 0, void 0, function* () {
21
+ yield this.getLogger();
22
+ }))();
23
+ }
24
+ getLogger() {
25
+ const logType = process.env.LOG_TYPE || 'console';
26
+ const level = process.env.LOG_LEVEL || "info";
27
+ switch (logType) {
28
+ case 'off':
29
+ console.log('Logging is off');
30
+ this.logger = new winston_1.default.Logger((0, loggerTransports_1.offTransport)());
31
+ // this.logger = winston.createLogger(config.offTransport());
32
+ // this.logger.cli();
33
+ break;
34
+ case 'console':
35
+ console.log('***********Logging to console***********');
36
+ this.logger = new winston_1.default.Logger((0, loggerTransports_1.consoleTransport)());
37
+ this.logger.format = winston_1.default.format.combine(winston_1.default.format.colorize(), winston_1.default.format.simple());
38
+ break;
39
+ // case 'aws':
40
+ // console.log('***********Logging to aws****************');
41
+ // this.logger = winston.createLogger(awsTransport(module));
42
+ // break;
43
+ case 'file':
44
+ console.log('***********Logging to file****************');
45
+ this.logger = new winston_1.default.Logger((0, loggerTransports_1.fileTransport)());
46
+ break;
47
+ default:
48
+ console.log('***********Default chosen:Logging to console***********');
49
+ // this.logger = consoleTransport();
50
+ // this.logger.cli();
51
+ break;
52
+ }
53
+ this.logger.level = level;
54
+ this.logger.format = this.getRequestLogFormatter();
55
+ // Call exceptions.handle with a transport to handle exceptions
56
+ // this.logger.exceptions.handle(
57
+ // new winston.transports.File({ filename: 'exceptions.log' })
58
+ // );
59
+ /* const DailyRotateFile = require('winston-daily-rotate-file');
60
+ this.logger.configure({
61
+ level: 'verbose',
62
+ transports: [
63
+ new DailyRotateFile(opts)
64
+ ]
65
+ });*/
66
+ this.logger.exitOnError = false; //winston will not exit after logging an uncaughtException
67
+ return this.logger;
68
+ }
69
+ getRequestLogFormatter() {
70
+ const { combine, timestamp, printf } = winston_1.default.format;
71
+ return combine(timestamp({
72
+ format: 'YYYY-MM-DD HH:mm:ss'
73
+ }),
74
+ // [${info.label}] winston.format.label({ label: path.basename(process.mainModule.filename) }),
75
+ winston_1.default.format.printf(info => `${info.timestamp} ${info.level} : ${info.message}`));
76
+ }
77
+ }
78
+ let log = new Logger().getLogger();
79
+ exports.default = log;
73
80
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../logger/index.ts"],"names":[],"mappings":";AAAA,iCAAiC;AACjC,gDAAgD;AAEhD,gCAAgC;AAEhC,0BAA0B;AAC1B,6DAA6D;AAC7D,yDAAyD;AACzD,sBAAsB;AACtB,gCAAgC;AAChC,6BAA6B;AAC7B,0BAA0B;AAC1B,iDAAiD;AACjD,wEAAwE;AACxE,gCAAgC;AAChC,yBAAyB;AAEzB,8BAA8B;AAC9B,2EAA2E;AAC3E,4EAA4E;AAC5E,6GAA6G;AAC7G,yBAAyB;AAGzB,0BAA0B;AAC1B,4EAA4E;AAC5E,8EAA8E;AAC9E,yBAAyB;AAEzB,2BAA2B;AAC3B,6EAA6E;AAC7E,yEAAyE;AACzE,yBAAyB;AAEzB,uBAAuB;AACvB,0FAA0F;AAC1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C;YACN,MAAM,EAAE,qBAAqB;SAChC,CAAC;QACF,iGAAiG;QACjG,iBAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,CAEtF,CAAC;IACN,CAAC;CAeJ;AAED,IAAI,GAAG,GAAG,IAAI,MAAM,EAAE,CAAC,SAAS,EAAE,CAAC;AACnC,kBAAe,GAAG,CAAC"}
@@ -0,0 +1,11 @@
1
+ import winston from "winston";
2
+ declare const offTransport: () => {
3
+ transports: never[];
4
+ };
5
+ declare const consoleTransport: () => {
6
+ transports: winston.transports.ConsoleTransportInstance[];
7
+ };
8
+ declare const fileTransport: () => {
9
+ transports: winston.transports.FileTransportInstance[];
10
+ };
11
+ export { offTransport, consoleTransport, fileTransport };
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.fileTransport = exports.consoleTransport = exports.offTransport = void 0;
7
+ const winston_1 = __importDefault(require("winston"));
8
+ // const awsEnv = (process.env.NODE_ENVIRONMENT || "dev");
9
+ // const awsRegion = (process.env.AWS_DEFAULT_REGION || "us-east-2");
10
+ // AWS.config.update({ region: awsRegion });
11
+ const offTransport = () => {
12
+ return {
13
+ transports: []
14
+ };
15
+ };
16
+ exports.offTransport = offTransport;
17
+ const consoleTransport = () => {
18
+ return {
19
+ transports: [
20
+ new (winston_1.default.transports.Console)({ level: 'info' })
21
+ /*,
22
+ new (winstonAwsCloudWatch)({
23
+ level: 'info',
24
+ timestamp: () => {
25
+ return new Date().toString()
26
+ },
27
+ json: true,
28
+ //logGroupName: 'apfTest', // REQUIRED
29
+ logGroupName: logGroup,//rachna
30
+ logStreamName: functionName,//rachna
31
+ // logStreamName: module, // REQUIRED
32
+ //logStreamName: 'invoicing', // REQUIRED
33
+
34
+ createLogGroup: true,
35
+ createLogStream: true,
36
+ awsRegion: awsRegion,
37
+ formatLog: function (item) {
38
+ return item.level + ': ' + item.message + ' ' + JSON.stringify(item.meta)
39
+ }
40
+ })*/
41
+ /* new (winston.transports.Console)({ level: 'info' ,format: winston.format.combine(
42
+ winston.format.timestamp(),
43
+ winston.format.colorize(),
44
+ winston.format.simple(),
45
+ winston.format.printf(info => `${info.timestamp} ${info.level}: ${info.message}`)
46
+ )}),*/
47
+ ]
48
+ };
49
+ };
50
+ exports.consoleTransport = consoleTransport;
51
+ // Replaces the previous transports with those in the
52
+ // new configuration wholesale.
53
+ //
54
+ // const DailyRotateFile = require('winston-daily-rotate-file');
55
+ // logger.configure({
56
+ // level: 'verbose',
57
+ // transports: [
58
+ // new DailyRotateFile(opts)
59
+ // ]
60
+ // });
61
+ const fileTransport = () => {
62
+ return {
63
+ transports: [
64
+ // - Write to all logs with level `info` and below to `combined.log`
65
+ // - Write all logs error (and below) to `error.log`.
66
+ new winston_1.default.transports.File({ filename: 'error.log', level: 'error' }),
67
+ new winston_1.default.transports.File({ filename: 'invoicing.log' }),
68
+ ]
69
+ };
70
+ };
71
+ exports.fileTransport = fileTransport;
72
+ //# sourceMappingURL=loggerTransports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loggerTransports.js","sourceRoot":"","sources":["../../../logger/loggerTransports.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA8B;AAC9B,0DAA0D;AAC1D,qEAAqE;AACrE,4CAA4C;AAE5C,MAAM,YAAY,GAAG,GAAG,EAAE;IACtB,OAAO;QACH,UAAU,EAAE,EAAE;KACjB,CAAC;AACN,CAAC,CAAA;AA2GQ,oCAAY;AAzGrB,MAAM,gBAAgB,GAAG,GAAG,EAAE;IAC1B,OAAO;QACH,UAAU,EAAE;YACR,IAAI,CAAC,iBAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;YACnD;;;;;;;;;;;;;;;;;;;gBAmBI;YACP;;;;;mBAKO;SACP;KACJ,CAAC;AACN,CAAC,CAAA;AAyEsB,4CAAgB;AAvEvC,qDAAqD;AACrD,+BAA+B;AAC/B,EAAE;AACF,gEAAgE;AAChE,qBAAqB;AACrB,sBAAsB;AACtB,kBAAkB;AAClB,gCAAgC;AAChC,MAAM;AACN,MAAM;AAEN,MAAM,aAAa,GAAG,GAAG,EAAE;IACvB,OAAO;QACH,UAAU,EAAE;YAChB,qEAAqE;YACrE,qDAAqD;YACrD,IAAI,iBAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;YACtE,IAAI,iBAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC;SACrD;KACJ,CAAC;AACN,CAAC,CAAA;AAmDwC,sCAAa"}
@@ -6,6 +6,7 @@ import BaseDynamoDBRepository from "./repository/dynamodb";
6
6
  import BaseCommunicationService from "./communication";
7
7
  import { HashService } from "./hashing";
8
8
  import hashids from "./hashing/idObfuscation";
9
+ import log from "./logger";
9
10
  import UrlService from "./shortner";
10
11
  import { Utils } from "./utils";
11
- export { AWS, axios, ENUM, Utils, BaseCommunicationService, WebHookEvent, BaseDynamoDBRepository, HashService, UrlService, hashids };
12
+ export { AWS, axios, ENUM, Utils, BaseCommunicationService, WebHookEvent, BaseDynamoDBRepository, HashService, UrlService, hashids, log };
package/dist/esm/index.js CHANGED
@@ -6,7 +6,8 @@ import BaseDynamoDBRepository from "./repository/dynamodb";
6
6
  import BaseCommunicationService from "./communication";
7
7
  import { HashService } from "./hashing";
8
8
  import hashids from "./hashing/idObfuscation";
9
+ import log from "./logger";
9
10
  import UrlService from "./shortner";
10
11
  import { Utils } from "./utils";
11
- export { AWS, axios, ENUM, Utils, BaseCommunicationService, WebHookEvent, BaseDynamoDBRepository, HashService, UrlService, hashids };
12
+ export { AWS, axios, ENUM, Utils, BaseCommunicationService, WebHookEvent, BaseDynamoDBRepository, HashService, UrlService, hashids, log };
12
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,sBAAsB,MAAM,uBAAuB,CAAC;AAC3D,OAAO,wBAAwB,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,OAAO,MAAM,yBAAyB,CAAC;AAC9C,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EACJ,GAAG,EACH,KAAK,EACL,IAAI,EACJ,KAAK,EACL,wBAAwB,EACxB,YAAY,EACZ,sBAAsB,EACtB,WAAW,EACX,UAAU,EACV,OAAO,EACT,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,sBAAsB,MAAM,uBAAuB,CAAC;AAC3D,OAAO,wBAAwB,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,OAAO,MAAM,yBAAyB,CAAC;AAC9C,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EACJ,GAAG,EACH,KAAK,EACL,IAAI,EACJ,KAAK,EACL,wBAAwB,EACxB,YAAY,EACZ,sBAAsB,EACtB,WAAW,EACX,UAAU,EACV,OAAO,EACP,GAAG,EACL,CAAA"}
@@ -0,0 +1,3 @@
1
+ import winston from "winston";
2
+ declare let log: winston.Logger;
3
+ export default log;
@@ -1,73 +1,75 @@
1
- "use strict";
2
- // import winston from "winston";
3
- // const config = require('./loggerTransports');
4
- // export default class Logger {
5
- // getLogger(module) {
6
- // const logType = process.env.LOG_TYPE || 'console';
7
- // const level = process.env.LOG_LEVEL || "info";
8
- // let logger;
9
- // console.log(logType);
10
- // switch (logType) {
11
- // case 'off':
12
- // console.log('Logging is off');
13
- // logger = winston.createLogger(config.offTransport());
14
- // logger.cli();
15
- // break;
16
- // case 'console':
17
- // console.log('***********Logging to console***********');
18
- // logger = winston.createLogger(config.consoleTransport());
19
- // logger.format = winston.format.combine(winston.format.colorize(), winston.format.simple())
20
- // break;
21
- // case 'aws':
22
- // console.log('***********Logging to aws****************');
23
- // logger = winston.createLogger(config.awsTransport(module));
24
- // break;
25
- // case 'file':
26
- // console.log('***********Logging to file****************');
27
- // logger = winston.createLogger(config.fileTransport());
28
- // break;
29
- // default:
30
- // console.log('***********Default chosen:Logging to console***********');
31
- // logger = (config.consoleTransport());
32
- // logger.cli();
33
- // break;
34
- // }
35
- // logger.level = level;
36
- // logger.format = this.getRequestLogFormatter();
37
- // // Call exceptions.handle with a transport to handle exceptions
38
- // // logger.exceptions.handle(
39
- // // new winston.transports.File({ filename: 'exceptions.log' })
40
- // // );
41
- // /* const DailyRotateFile = require('winston-daily-rotate-file');
42
- // logger.configure({
43
- // level: 'verbose',
44
- // transports: [
45
- // new DailyRotateFile(opts)
46
- // ]
47
- // });*/
48
- // logger.exitOnError = false; //winston will not exit after logging an uncaughtException
49
- // return logger;
50
- // }
51
- // getRequestLogFormatter() {
52
- // const { combine, timestamp, printf } = winston.format;
53
- // return combine(
54
- // timestamp({
55
- // format: 'YYYY-MM-DD HH:mm:ss'
56
- // }),
57
- // // [${info.label}] winston.format.label({ label: path.basename(process.mainModule.filename) }),
58
- // winston.format.printf(info => `${info.timestamp} ${info.level} : ${info.message}`)
59
- // );
60
- // }
61
- // logError(err, req, res, next) {
62
- // logger.error(err)
63
- // next();
64
- // }
65
- // logRequest(req, res, next, log) {
66
- // log.info('hello');
67
- // next();
68
- // }
69
- // getLog() {
70
- // return this.logger;
71
- // }
72
- // }
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import winston from "winston";
11
+ import { offTransport, fileTransport, consoleTransport } from "./loggerTransports";
12
+ class Logger {
13
+ constructor() {
14
+ this.logger = new winston.Logger(consoleTransport());
15
+ (() => __awaiter(this, void 0, void 0, function* () {
16
+ yield this.getLogger();
17
+ }))();
18
+ }
19
+ getLogger() {
20
+ const logType = process.env.LOG_TYPE || 'console';
21
+ const level = process.env.LOG_LEVEL || "info";
22
+ switch (logType) {
23
+ case 'off':
24
+ console.log('Logging is off');
25
+ this.logger = new winston.Logger(offTransport());
26
+ // this.logger = winston.createLogger(config.offTransport());
27
+ // this.logger.cli();
28
+ break;
29
+ case 'console':
30
+ console.log('***********Logging to console***********');
31
+ this.logger = new winston.Logger(consoleTransport());
32
+ this.logger.format = winston.format.combine(winston.format.colorize(), winston.format.simple());
33
+ break;
34
+ // case 'aws':
35
+ // console.log('***********Logging to aws****************');
36
+ // this.logger = winston.createLogger(awsTransport(module));
37
+ // break;
38
+ case 'file':
39
+ console.log('***********Logging to file****************');
40
+ this.logger = new winston.Logger(fileTransport());
41
+ break;
42
+ default:
43
+ console.log('***********Default chosen:Logging to console***********');
44
+ // this.logger = consoleTransport();
45
+ // this.logger.cli();
46
+ break;
47
+ }
48
+ this.logger.level = level;
49
+ this.logger.format = this.getRequestLogFormatter();
50
+ // Call exceptions.handle with a transport to handle exceptions
51
+ // this.logger.exceptions.handle(
52
+ // new winston.transports.File({ filename: 'exceptions.log' })
53
+ // );
54
+ /* const DailyRotateFile = require('winston-daily-rotate-file');
55
+ this.logger.configure({
56
+ level: 'verbose',
57
+ transports: [
58
+ new DailyRotateFile(opts)
59
+ ]
60
+ });*/
61
+ this.logger.exitOnError = false; //winston will not exit after logging an uncaughtException
62
+ return this.logger;
63
+ }
64
+ getRequestLogFormatter() {
65
+ const { combine, timestamp, printf } = winston.format;
66
+ return combine(timestamp({
67
+ format: 'YYYY-MM-DD HH:mm:ss'
68
+ }),
69
+ // [${info.label}] winston.format.label({ label: path.basename(process.mainModule.filename) }),
70
+ winston.format.printf(info => `${info.timestamp} ${info.level} : ${info.message}`));
71
+ }
72
+ }
73
+ let log = new Logger().getLogger();
74
+ export default log;
73
75
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../logger/index.ts"],"names":[],"mappings":";AAAA,iCAAiC;AACjC,gDAAgD;AAEhD,gCAAgC;AAEhC,0BAA0B;AAC1B,6DAA6D;AAC7D,yDAAyD;AACzD,sBAAsB;AACtB,gCAAgC;AAChC,6BAA6B;AAC7B,0BAA0B;AAC1B,iDAAiD;AACjD,wEAAwE;AACxE,gCAAgC;AAChC,yBAAyB;AAEzB,8BAA8B;AAC9B,2EAA2E;AAC3E,4EAA4E;AAC5E,6GAA6G;AAC7G,yBAAyB;AAGzB,0BAA0B;AAC1B,4EAA4E;AAC5E,8EAA8E;AAC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CAAC;IACvB,CAAC;IAEO,sBAAsB;QAC1B,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;QACtD,OAAO,OAAO,CACV,SAAS,CAAC;YACN,MAAM,EAAE,qBAAqB;SAChC,CAAC;QACF,iGAAiG;QACjG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,CAEtF,CAAC;IACN,CAAC;CAeJ;AAED,IAAI,GAAG,GAAG,IAAI,MAAM,EAAE,CAAC,SAAS,EAAE,CAAC;AACnC,eAAe,GAAG,CAAC"}
@@ -0,0 +1,11 @@
1
+ import winston from "winston";
2
+ declare const offTransport: () => {
3
+ transports: never[];
4
+ };
5
+ declare const consoleTransport: () => {
6
+ transports: winston.transports.ConsoleTransportInstance[];
7
+ };
8
+ declare const fileTransport: () => {
9
+ transports: winston.transports.FileTransportInstance[];
10
+ };
11
+ export { offTransport, consoleTransport, fileTransport };
@@ -0,0 +1,105 @@
1
+ import winston from "winston";
2
+ // const awsEnv = (process.env.NODE_ENVIRONMENT || "dev");
3
+ // const awsRegion = (process.env.AWS_DEFAULT_REGION || "us-east-2");
4
+ // AWS.config.update({ region: awsRegion });
5
+ const offTransport = () => {
6
+ return {
7
+ transports: []
8
+ };
9
+ };
10
+ const consoleTransport = () => {
11
+ return {
12
+ transports: [
13
+ new (winston.transports.Console)({ level: 'info' })
14
+ /*,
15
+ new (winstonAwsCloudWatch)({
16
+ level: 'info',
17
+ timestamp: () => {
18
+ return new Date().toString()
19
+ },
20
+ json: true,
21
+ //logGroupName: 'apfTest', // REQUIRED
22
+ logGroupName: logGroup,//rachna
23
+ logStreamName: functionName,//rachna
24
+ // logStreamName: module, // REQUIRED
25
+ //logStreamName: 'invoicing', // REQUIRED
26
+
27
+ createLogGroup: true,
28
+ createLogStream: true,
29
+ awsRegion: awsRegion,
30
+ formatLog: function (item) {
31
+ return item.level + ': ' + item.message + ' ' + JSON.stringify(item.meta)
32
+ }
33
+ })*/
34
+ /* new (winston.transports.Console)({ level: 'info' ,format: winston.format.combine(
35
+ winston.format.timestamp(),
36
+ winston.format.colorize(),
37
+ winston.format.simple(),
38
+ winston.format.printf(info => `${info.timestamp} ${info.level}: ${info.message}`)
39
+ )}),*/
40
+ ]
41
+ };
42
+ };
43
+ // Replaces the previous transports with those in the
44
+ // new configuration wholesale.
45
+ //
46
+ // const DailyRotateFile = require('winston-daily-rotate-file');
47
+ // logger.configure({
48
+ // level: 'verbose',
49
+ // transports: [
50
+ // new DailyRotateFile(opts)
51
+ // ]
52
+ // });
53
+ const fileTransport = () => {
54
+ return {
55
+ transports: [
56
+ // - Write to all logs with level `info` and below to `combined.log`
57
+ // - Write all logs error (and below) to `error.log`.
58
+ new winston.transports.File({ filename: 'error.log', level: 'error' }),
59
+ new winston.transports.File({ filename: 'invoicing.log' }),
60
+ ]
61
+ };
62
+ };
63
+ // const awsTransport = (module) => {
64
+ // const awsConfig = {
65
+ // region: region
66
+ // }
67
+ // // const client = elasticsearch.Client({
68
+ // // hosts: hosts,
69
+ // // connectionClass: awses,
70
+ // // log: 'trace'
71
+ // // });
72
+ // //Configuring AWS Credentials once
73
+ // AWS.config.update({
74
+ // region: region
75
+ // });
76
+ // return {
77
+ // transports: [
78
+ // new (winstonAwsCloudWatch)({
79
+ // level: 'info',
80
+ // timestamp: () => {
81
+ // return new Date().toString()
82
+ // },
83
+ // json: true,
84
+ // logGroupName: 'AuroCXTest', // REQUIRED
85
+ // logStreamName: module, // REQUIRED
86
+ // //logStreamName: 'invoicing', // REQUIRED
87
+ // createLogGroup: true,
88
+ // createLogStream: true,
89
+ // awsRegion: awsRegion,
90
+ // formatLog: function (item:any) {
91
+ // return item.level + ': ' + item.message + ' ' + JSON.stringify(item.meta)
92
+ // }
93
+ // }),
94
+ // // new (WinstonElasticsearch)({
95
+ // // level: 'info',
96
+ // // client: client,
97
+ // // formatLog: function (item) {
98
+ // // return item.level + ': ' + item.message + ' ' + JSON.stringify(item.meta)
99
+ // // }
100
+ // // })
101
+ // ]
102
+ // };
103
+ // }
104
+ export { offTransport, consoleTransport, fileTransport };
105
+ //# sourceMappingURL=loggerTransports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loggerTransports.js","sourceRoot":"","sources":["../../../logger/loggerTransports.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,0DAA0D;AAC1D,qEAAqE;AACrE,4CAA4C;AAE5C,MAAM,YAAY,GAAG,GAAG,EAAE;IACtB,OAAO;QACH,UAAU,EAAE,EAAE;KACjB,CAAC;AACN,CAAC,CAAA;AAED,MAAM,gBAAgB,GAAG,GAAG,EAAE;IAC1B,OAAO;QACH,UAAU,EAAE;YACR,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;YACnD;;;;;;;;;;;;;;;;;;;gBAmBI;YACP;;;;;mBAKO;SACP;KACJ,CAAC;AACN,CAAC,CAAA;AAED,qDAAqD;AACrD,+BAA+B;AAC/B,EAAE;AACF,gEAAgE;AAChE,qBAAqB;AACrB,sBAAsB;AACtB,kBAAkB;AAClB,gCAAgC;AAChC,MAAM;AACN,MAAM;AAEN,MAAM,aAAa,GAAG,GAAG,EAAE;IACvB,OAAO;QACH,UAAU,EAAE;YAChB,qEAAqE;YACrE,qDAAqD;YACrD,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;YACtE,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC;SACrD;KACJ,CAAC;AACN,CAAC,CAAA;AAGD,qCAAqC;AACrC,0BAA0B;AAC1B,yBAAyB;AACzB,QAAQ;AAER,+CAA+C;AAC/C,2BAA2B;AAC3B,qCAAqC;AACrC,0BAA0B;AAC1B,aAAa;AAEb,yCAAyC;AACzC,0BAA0B;AAC1B,yBAAyB;AACzB,UAAU;AAEV,eAAe;AACf,wBAAwB;AACxB,2CAA2C;AAC3C,iCAAiC;AACjC,qCAAqC;AACrC,mDAAmD;AACnD,qBAAqB;AACrB,8BAA8B;AAC9B,0DAA0D;AAG1D,qDAAqD;AACrD,4DAA4D;AAE5D,wCAAwC;AACxC,yCAAyC;AACzC,wCAAwC;AACxC,mDAAmD;AACnD,gGAAgG;AAChG,oBAAoB;AACpB,kBAAkB;AAClB,8CAA8C;AAC9C,oCAAoC;AACpC,qCAAqC;AACrC,kDAAkD;AAClD,mGAAmG;AACnG,uBAAuB;AACvB,oBAAoB;AACpB,YAAY;AACZ,SAAS;AACT,IAAI;AAEJ,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chatbot-nc",
3
- "version": "2.0.40",
3
+ "version": "2.0.42",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",