@spinajs/log 2.0.46 → 2.0.48

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.
@@ -1,43 +1,45 @@
1
- /*
2
- 👋 Hi! This file was autogenerated by tslint-to-eslint-config.
3
- https://github.com/typescript-eslint/tslint-to-eslint-config
4
-
5
- It represents the closest reasonable ESLint configuration to this
6
- project's original TSLint configuration.
7
-
8
- We recommend eventually switching this configuration to extend from
9
- the recommended rulesets in typescript-eslint.
10
- https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md
11
-
12
- Happy linting! 💖
13
- */
14
- module.exports = {
15
- root: true,
16
- env: {
17
- browser: true,
18
- es6: true,
19
- },
20
- ignorePatterns: ['.eslintrc.js'],
21
- extends: [
22
- 'plugin:security/recommended',
23
- 'plugin:import/errors',
24
- 'plugin:import/warnings',
25
- 'plugin:import/typescript',
26
- 'plugin:promise/recommended',
27
- 'plugin:@typescript-eslint/recommended',
28
- 'plugin:@typescript-eslint/recommended-requiring-type-checking',
29
- ],
30
- parser: '@typescript-eslint/parser',
31
- parserOptions: {
32
- project: 'tsconfig.json',
33
- sourceType: 'module',
34
- },
35
- plugins: ['promise', 'prettier', 'eslint-plugin-import', 'eslint-plugin-prefer-arrow', '@typescript-eslint', 'tsdoc', 'security'],
36
- rules: {
37
- 'tsdoc/syntax': 'warn',
38
- "@typescript-eslint/require-await": "off",
39
- "security/detect-unsafe-regex" : "off",
40
- '@typescript-eslint/no-explicit-any': 'off',
41
- },
42
- };
1
+ /*
2
+ 👋 Hi! This file was autogenerated by tslint-to-eslint-config.
3
+ https://github.com/typescript-eslint/tslint-to-eslint-config
4
+
5
+ It represents the closest reasonable ESLint configuration to this
6
+ project's original TSLint configuration.
7
+
8
+ We recommend eventually switching this configuration to extend from
9
+ the recommended rulesets in typescript-eslint.
10
+ https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md
11
+
12
+ Happy linting! 💖
13
+ */
14
+ module.exports = {
15
+ root: true,
16
+ env: {
17
+ browser: true,
18
+ es6: true,
19
+ },
20
+ ignorePatterns: ['.eslintrc.js'],
21
+ extends: [
22
+ 'plugin:security/recommended',
23
+ 'plugin:import/errors',
24
+ 'plugin:import/warnings',
25
+ 'plugin:import/typescript',
26
+ 'plugin:promise/recommended',
27
+ 'plugin:@typescript-eslint/recommended',
28
+ 'plugin:@typescript-eslint/recommended-requiring-type-checking',
29
+ ],
30
+ parser: '@typescript-eslint/parser',
31
+ parserOptions: {
32
+ project: 'tsconfig.json',
33
+ sourceType: 'module',
34
+ },
35
+ plugins: ['promise', 'prettier', 'eslint-plugin-import', 'eslint-plugin-prefer-arrow', '@typescript-eslint', 'tsdoc', 'security'],
36
+ rules: {
37
+ 'tsdoc/syntax': 'warn',
38
+ 'import/no-unresolved': 'off',
39
+
40
+ "@typescript-eslint/require-await": "off",
41
+ "security/detect-unsafe-regex" : "off",
42
+ '@typescript-eslint/no-explicit-any': 'off',
43
+ },
44
+ };
43
45
 
package/.mocharc.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "extensions": ["ts"],
3
+ "spec": ["packages/configuration/test/*.test.ts"],
4
+ "node-option": [
5
+ "experimental-specifier-resolution=node",
6
+ "loader=ts-node/esm"
7
+ ]
8
+ }
package/package.json CHANGED
@@ -1,23 +1,26 @@
1
1
  {
2
2
  "name": "@spinajs/log",
3
- "version": "2.0.46",
3
+ "version": "2.0.48",
4
4
  "description": "Log lib for all spinejs related libs",
5
- "main": "lib/index.js",
5
+ "exports": "./lib/index.js",
6
+ "type": "module",
6
7
  "private": false,
8
+ "engines": {
9
+ "node": ">=16.11"
10
+ },
7
11
  "scripts": {
12
+ "build": "npm run clean && npm run compile",
13
+ "compile": "tsc -b tsconfig.json",
14
+ "rimraf": "./node_modules/rimraf/bin.js",
15
+ "clean": "rimraf lib/ && rimraf tsconfig.tsbuildinfo",
8
16
  "test": "ts-mocha -p tsconfig.json test/**/*.test.ts",
9
17
  "coverage": "nyc npm run test",
10
18
  "build-docs": "rimraf docs && typedoc --options typedoc.json src/",
11
- "build": "npm run clean && npm run compile",
12
- "compile": "tsc -p tsconfig.build.json",
13
- "clean": "",
14
- "prepare": "npm run build",
15
19
  "format": "prettier --write \"src/**/*.ts\"",
16
- "lint": "eslint -c .eslintrc.js --ext .ts src",
17
- "prepublishOnly": "npm test && npm run lint",
20
+ "lint": "eslint -c .eslintrc.cjs --ext .ts src --fix",
18
21
  "preversion": "npm run lint",
19
- "version": "git add -A src",
20
- "postversion": "git push && git push --tags"
22
+ "version": "npm run format && git add -A src",
23
+ "postinstall": "npm run build"
21
24
  },
22
25
  "author": "SpinaJS <spinajs@coderush.pl> (https://github.com/spinajs/log)",
23
26
  "license": "MIT",
@@ -27,24 +30,25 @@
27
30
  "homepage": "https://github.com/spinajs/log#readme",
28
31
  "dependencies": {
29
32
  "@colors/colors": "^1.5.0",
30
- "@spinajs/configuration": "^2.0.45",
31
- "@spinajs/di": "^2.0.45",
33
+ "@spinajs/configuration": "^2.0.46",
34
+ "@spinajs/di": "^2.0.46",
32
35
  "@spinajs/exceptions": "^2.0.39",
33
- "@spinajs/log-common": "^2.0.45",
34
- "ajv": "^8.11.0",
35
- "chalk": "4.1.2",
36
- "glob": "^7.2.0",
36
+ "@spinajs/internal-logger": "^2.0.46",
37
+ "@spinajs/log-common": "^2.0.46",
38
+ "ajv": "^8.12.0",
39
+ "chalk": "5.2.0",
40
+ "glob": "^8.1.0",
37
41
  "glob-to-regexp": "^0.4.1",
38
- "lodash": "^4.17.14",
42
+ "lodash": "^4.17.21",
39
43
  "luxon": "^3.2.1",
40
- "node-schedule": "^2.1.0"
44
+ "node-schedule": "^2.1.1"
41
45
  },
42
46
  "devDependencies": {
43
- "@types/glob": "7.2.0",
47
+ "@types/glob": "8.0.1",
44
48
  "@types/glob-to-regexp": "^0.4.1",
45
49
  "@types/mock-fs": "^4.13.1",
46
- "@types/node-schedule": "^1.3.2",
47
- "mock-fs": "^5.1.2"
50
+ "@types/node-schedule": "^2.1.0",
51
+ "mock-fs": "^5.2.0"
48
52
  },
49
53
  "gitHead": "002dc553b0ffffd72193d0121ac425a4083bc9ee"
50
54
  }
@@ -1,4 +0,0 @@
1
- import { Bootstrapper } from "@spinajs/di";
2
- export declare class LogBotstrapper extends Bootstrapper {
3
- bootstrap(): void;
4
- }
package/lib/bootstrap.js DELETED
@@ -1,55 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __importDefault = (this && this.__importDefault) || function (mod) {
9
- return (mod && mod.__esModule) ? mod : { "default": mod };
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.LogBotstrapper = void 0;
13
- const configuration_1 = require("@spinajs/configuration");
14
- const di_1 = require("@spinajs/di");
15
- const log_1 = require("./log");
16
- const log_configuration_1 = __importDefault(require("./schemas/log.configuration"));
17
- let LogBotstrapper = class LogBotstrapper extends di_1.Bootstrapper {
18
- bootstrap() {
19
- di_1.DI.register(log_configuration_1.default).asValue("__configurationSchema__");
20
- // check if we run tests,
21
- // hook for uncaughtException causes to not showing
22
- // mocha errors in console
23
- if (!process.env.TESTING) {
24
- process.on("uncaughtException", (err) => {
25
- // if we have configuration resolved, we can assume that logger can read configuration
26
- // so log to default log
27
- // if not log to console
28
- if (di_1.DI.has(configuration_1.Configuration)) {
29
- const log = di_1.DI.resolve(log_1.Log, ["process"]);
30
- log.fatal(err, "Unhandled exception occured");
31
- }
32
- else {
33
- console.error("Unhandled exception occured, reason:" + JSON.stringify(err));
34
- }
35
- });
36
- process.on("unhandledRejection", (reason, p) => {
37
- // if we have configuration resolved, we can assume that logger can read configuration
38
- // so log to default log
39
- // if not log to console
40
- if (di_1.DI.has(configuration_1.Configuration)) {
41
- const log = di_1.DI.resolve(log_1.Log, ["process"]);
42
- log.fatal(reason, "Unhandled rejection at Promise %s", p);
43
- }
44
- else {
45
- console.error("Unhandled rejection at Promise %s, reason: " + JSON.stringify(reason));
46
- }
47
- });
48
- }
49
- }
50
- };
51
- LogBotstrapper = __decorate([
52
- (0, di_1.Injectable)(di_1.Bootstrapper)
53
- ], LogBotstrapper);
54
- exports.LogBotstrapper = LogBotstrapper;
55
- //# sourceMappingURL=bootstrap.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0DAAuD;AACvD,oCAA2D;AAC3D,+BAA4B;AAC5B,oFAA+D;AAG/D,IAAa,cAAc,GAA3B,MAAa,cAAe,SAAQ,iBAAY;IACvC,SAAS;QACd,OAAE,CAAC,QAAQ,CAAC,2BAAoB,CAAC,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;QAErE,yBAAyB;QACzB,mDAAmD;QACnD,0BAA0B;QAC1B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE;YACxB,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,GAAG,EAAE,EAAE;gBACtC,sFAAsF;gBACtF,wBAAwB;gBACxB,wBAAwB;gBACxB,IAAI,OAAE,CAAC,GAAG,CAAC,6BAAa,CAAC,EAAE;oBACzB,MAAM,GAAG,GAAG,OAAE,CAAC,OAAO,CAAC,SAAG,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;oBACzC,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,6BAA6B,CAAC,CAAC;iBAC/C;qBAAM;oBACL,OAAO,CAAC,KAAK,CAAC,sCAAsC,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;iBAC7E;YACH,CAAC,CAAC,CAAC;YAEH,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC7C,sFAAsF;gBACtF,wBAAwB;gBACxB,wBAAwB;gBACxB,IAAI,OAAE,CAAC,GAAG,CAAC,6BAAa,CAAC,EAAE;oBACzB,MAAM,GAAG,GAAG,OAAE,CAAC,OAAO,CAAC,SAAG,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;oBACzC,GAAG,CAAC,KAAK,CAAC,MAAe,EAAE,mCAAmC,EAAE,CAAC,CAAC,CAAC;iBACpE;qBAAM;oBACL,OAAO,CAAC,KAAK,CAAC,6CAA6C,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;iBACvF;YACH,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;CACF,CAAA;AAjCY,cAAc;IAD1B,IAAA,eAAU,EAAC,iBAAY,CAAC;GACZ,cAAc,CAiC1B;AAjCY,wCAAc"}
@@ -1,6 +0,0 @@
1
- /**
2
- * Creates ( if not exists ) new logger instance with given name and optional variables
3
- * @param name - name of logger
4
- * @param variables - optional log variables
5
- */
6
- export declare function Logger(name: string, variables?: Record<string, unknown>): (target: any, key: string) => any;
package/lib/decorators.js DELETED
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Logger = void 0;
4
- /* eslint-disable @typescript-eslint/no-unsafe-member-access */
5
- /* eslint-disable @typescript-eslint/no-unsafe-assignment */
6
- const di_1 = require("@spinajs/di");
7
- const log_1 = require("./log");
8
- /**
9
- * Creates ( if not exists ) new logger instance with given name and optional variables
10
- * @param name - name of logger
11
- * @param variables - optional log variables
12
- */
13
- function Logger(name, variables) {
14
- return (target, key) => {
15
- let logger;
16
- // property getter
17
- const getter = () => {
18
- if (!logger) {
19
- const allLoggers = di_1.DI.get(Array.ofType(log_1.Log));
20
- const found = allLoggers.find((l) => l.Name);
21
- if (found) {
22
- logger = found;
23
- }
24
- else {
25
- logger = di_1.DI.resolve(log_1.Log, [name, variables]);
26
- }
27
- }
28
- return logger;
29
- };
30
- // Create new property with getter and setter
31
- Object.defineProperty(target, key, {
32
- get: getter,
33
- enumerable: false,
34
- configurable: false,
35
- });
36
- };
37
- }
38
- exports.Logger = Logger;
39
- //# sourceMappingURL=decorators.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":";;;AAAA,+DAA+D;AAC/D,4DAA4D;AAC5D,oCAAiC;AACjC,+BAA4B;AAE5B;;;;GAIG;AACH,SAAgB,MAAM,CAAC,IAAY,EAAE,SAAmC;IACtE,OAAO,CAAC,MAAW,EAAE,GAAW,EAAO,EAAE;QACvC,IAAI,MAAW,CAAC;QAEhB,kBAAkB;QAClB,MAAM,MAAM,GAAG,GAAG,EAAE;YAClB,IAAI,CAAC,MAAM,EAAE;gBACX,MAAM,UAAU,GAAG,OAAE,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,SAAG,CAAC,CAAC,CAAC;gBAC7C,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;gBAE7C,IAAI,KAAK,EAAE;oBACT,MAAM,GAAG,KAAK,CAAC;iBAChB;qBAAM;oBACL,MAAM,GAAG,OAAE,CAAC,OAAO,CAAC,SAAG,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;iBAC7C;aACF;YACD,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC;QAEF,6CAA6C;QAC7C,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE;YACjC,GAAG,EAAE,MAAM;YACX,UAAU,EAAE,KAAK;YACjB,YAAY,EAAE,KAAK;SACpB,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AA1BD,wBA0BC"}
package/lib/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export * from "@spinajs/log-common";
2
- export * from "./targets";
3
- export * from "./log";
4
- export * from "./decorators";
5
- export * from "./bootstrap";
package/lib/index.js DELETED
@@ -1,22 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("@spinajs/log-common"), exports);
18
- __exportStar(require("./targets"), exports);
19
- __exportStar(require("./log"), exports);
20
- __exportStar(require("./decorators"), exports);
21
- __exportStar(require("./bootstrap"), exports);
22
- //# sourceMappingURL=index.js.map
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,4CAA0B;AAC1B,wCAAsB;AACtB,+CAA6B;AAC7B,8CAA4B"}
package/lib/log.d.ts DELETED
@@ -1,49 +0,0 @@
1
- import { Container, SyncService } from "@spinajs/di";
2
- import { ILogOptions, ILogRule, ILogEntry, LogVariables, ILog, ILogTargetDesc } from "@spinajs/log-common";
3
- /**
4
- * Default log implementation interface. Taken from bunyan. Feel free to implement own.
5
- */
6
- export declare class Log extends SyncService implements ILog {
7
- Name: string;
8
- protected Parent?: Log;
9
- /**
10
- * STATIC METHODS FOR LOGGER, ALLOWS TO LOG TO ANY TARGET
11
- * EVEN BEFORE LOG MODULE INITIALIZATION.
12
- *
13
- * Prevents from losing log message when initializing modules
14
- */
15
- static Loggers: Map<string, Log>;
16
- Timers: Map<string, Date>;
17
- Targets: ILogTargetDesc[];
18
- static clearLoggers(): void;
19
- protected static AttachedToExitEvents: boolean;
20
- protected Options: ILogOptions;
21
- protected Rules: ILogRule[];
22
- protected Variables: Record<string, any>;
23
- protected Container: Container;
24
- constructor(Name: string, variables?: Record<string, unknown>, Parent?: Log);
25
- addVariable(name: string, value: unknown): void;
26
- timeStart(name: string): void;
27
- timeEnd(name: string): number;
28
- resolve(): void;
29
- trace(message: string, ...args: any[]): void;
30
- trace(err: Error, message: string, ...args: any[]): void;
31
- debug(message: string, ...args: any[]): void;
32
- debug(err: Error, message: string, ...args: any[]): void;
33
- info(message: string, ...args: any[]): void;
34
- info(err: Error, message: string, ...args: any[]): void;
35
- warn(message: string, ...args: any[]): void;
36
- warn(err: Error, message: string, ...args: any[]): void;
37
- error(message: string, ...args: any[]): void;
38
- error(err: Error, message: string, ...args: any[]): void;
39
- fatal(message: string, ...args: any[]): void;
40
- fatal(err: Error, message: string, ...args: any[]): void;
41
- security(message: string, ...args: any[]): void;
42
- security(err: Error, message: string, ...args: any[]): void;
43
- success(message: string, ...args: any[]): void;
44
- success(err: Error, message: string, ...args: any[]): void;
45
- write(entry: ILogEntry): Promise<PromiseSettledResult<void>[]>;
46
- child(name: string, variables?: LogVariables): Log;
47
- protected resolveLogTargets(): void;
48
- protected matchRulesToLogger(): void;
49
- }
package/lib/log.js DELETED
@@ -1,194 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- var Log_1;
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.Log = void 0;
17
- /* eslint-disable @typescript-eslint/no-unsafe-assignment */
18
- /* eslint-disable @typescript-eslint/no-unsafe-call */
19
- /* eslint-disable @typescript-eslint/no-unsafe-argument */
20
- const configuration_1 = require("@spinajs/configuration");
21
- const di_1 = require("@spinajs/di");
22
- const log_common_1 = require("@spinajs/log-common");
23
- const glob_to_regexp_1 = __importDefault(require("glob-to-regexp"));
24
- const exceptions_1 = require("@spinajs/exceptions");
25
- function wrapWrite(level) {
26
- return (err, message, ...args) => {
27
- if (err instanceof Error) {
28
- return this.write((0, log_common_1.createLogMessageObject)(err, message, level, this.Name, this.Variables, ...args));
29
- }
30
- else {
31
- if (message) {
32
- return this.write((0, log_common_1.createLogMessageObject)(err, null, level, this.Name, this.Variables, ...[message, ...args]));
33
- }
34
- else {
35
- return this.write((0, log_common_1.createLogMessageObject)(err, null, level, this.Name, this.Variables, ...args));
36
- }
37
- }
38
- };
39
- }
40
- /**
41
- * Default log implementation interface. Taken from bunyan. Feel free to implement own.
42
- */
43
- let Log = Log_1 = class Log extends di_1.SyncService {
44
- constructor(Name, variables, Parent) {
45
- super();
46
- this.Name = Name;
47
- this.Parent = Parent;
48
- this.Timers = new Map();
49
- this.Variables = {};
50
- this.Variables = variables !== null && variables !== void 0 ? variables : {};
51
- }
52
- static clearLoggers() {
53
- Log_1.Loggers.clear();
54
- }
55
- addVariable(name, value) {
56
- this.Variables[`${name}`] = value;
57
- }
58
- timeStart(name) {
59
- if (this.Timers.has(name)) {
60
- return;
61
- }
62
- this.Timers.set(name, new Date());
63
- }
64
- timeEnd(name) {
65
- if (this.Timers.has(name)) {
66
- const cTime = new Date();
67
- const diff = cTime.getTime() - this.Timers.get(name).getTime();
68
- this.Timers.delete(name);
69
- return diff;
70
- }
71
- return 0;
72
- }
73
- resolve() {
74
- const config = this.Container.get(configuration_1.Configuration);
75
- if (!config) {
76
- throw new Error(`Configuration module is not avaible. Please resolve configuration module before any logging can occur`);
77
- }
78
- this.Options = config.get("logger", {
79
- targets: [
80
- {
81
- name: "Console",
82
- type: "ConsoleTarget",
83
- },
84
- ],
85
- rules: [{ name: "*", level: "trace", target: "Console" }],
86
- });
87
- this.matchRulesToLogger();
88
- this.resolveLogTargets();
89
- super.resolve();
90
- Log_1.Loggers.set(this.Name, this);
91
- }
92
- trace(err, message, ...args) {
93
- wrapWrite.apply(this, [log_common_1.LogLevel.Trace])(err, message, ...args);
94
- }
95
- debug(err, message, ...args) {
96
- wrapWrite.apply(this, [log_common_1.LogLevel.Debug])(err, message, ...args);
97
- }
98
- info(err, message, ...args) {
99
- wrapWrite.apply(this, [log_common_1.LogLevel.Info])(err, message, ...args);
100
- }
101
- warn(err, message, ...args) {
102
- wrapWrite.apply(this, [log_common_1.LogLevel.Warn])(err, message, ...args);
103
- }
104
- error(err, message, ...args) {
105
- wrapWrite.apply(this, [log_common_1.LogLevel.Error])(err, message, ...args);
106
- }
107
- fatal(err, message, ...args) {
108
- wrapWrite.apply(this, [log_common_1.LogLevel.Fatal])(err, message, ...args);
109
- }
110
- security(err, message, ...args) {
111
- wrapWrite.apply(this, [log_common_1.LogLevel.Security])(err, message, ...args);
112
- }
113
- success(err, message, ...args) {
114
- wrapWrite.apply(this, [log_common_1.LogLevel.Success])(err, message, ...args);
115
- }
116
- write(entry) {
117
- if (entry.Variables.logger === this.Name) {
118
- return Promise.allSettled(this.Targets.filter((t) => entry.Level >= log_common_1.StrToLogLevel[t.rule.level]).map((t) => {
119
- if (!t.instance) {
120
- throw new exceptions_1.InvalidOperation(`Target for rule ${t.rule.name} not exists`);
121
- }
122
- return t.instance.write(entry);
123
- }));
124
- }
125
- }
126
- child(name, variables) {
127
- return di_1.DI.resolve(Log_1, [
128
- `${this.Name}.${name}`,
129
- Object.assign(Object.assign({}, this.Variables), variables),
130
- this,
131
- ]);
132
- }
133
- resolveLogTargets() {
134
- this.Targets = this.Rules.map((r) => {
135
- const found = this.Options.targets.filter((t) => {
136
- return Array.isArray(r.target) ? r.target.includes(t.name) : r.target === t.name;
137
- });
138
- if (!found) {
139
- throw new exceptions_1.InvalidOption(`No target matching rule ${r.name}`);
140
- }
141
- return found.map((f) => {
142
- return {
143
- instance: di_1.DI.resolve(f.type, [f]),
144
- options: f,
145
- rule: r,
146
- };
147
- });
148
- }).reduce((prev, curr) => prev.concat(...curr), []);
149
- }
150
- matchRulesToLogger() {
151
- this.Rules = this.Options.rules.filter((r) => {
152
- const g = (0, glob_to_regexp_1.default)(r.name);
153
- // BUG: g.test throws vscode err ?
154
- return g.test(this.Name);
155
- });
156
- }
157
- };
158
- /**
159
- * STATIC METHODS FOR LOGGER, ALLOWS TO LOG TO ANY TARGET
160
- * EVEN BEFORE LOG MODULE INITIALIZATION.
161
- *
162
- * Prevents from losing log message when initializing modules
163
- */
164
- Log.Loggers = new Map();
165
- Log.AttachedToExitEvents = false;
166
- __decorate([
167
- (0, di_1.Autoinject)(),
168
- __metadata("design:type", di_1.Container)
169
- ], Log.prototype, "Container", void 0);
170
- Log = Log_1 = __decorate([
171
- (0, di_1.NewInstance)(),
172
- __metadata("design:paramtypes", [String, Object, Log])
173
- ], Log);
174
- exports.Log = Log;
175
- const logFactoryFunction = (container, logName) => {
176
- if (Log.Loggers.has(logName)) {
177
- return Log.Loggers.get(logName);
178
- }
179
- return container.resolve("__logImplementation__", [logName]);
180
- };
181
- // register as string identifier to allow for
182
- // resolving logs without referencing class
183
- // to avoid circular dependencies in some @spinajs packages
184
- // it should not be used in production code
185
- di_1.DI.register(logFactoryFunction).as("__log__");
186
- // register log factory function as Log class
187
- // this way we can create or return already created
188
- // log objects
189
- di_1.DI.register(logFactoryFunction).as(Log);
190
- // register Log class as string literal
191
- // so we can resolve Log class
192
- // it should not be used in production code
193
- di_1.DI.register(Log).as("__logImplementation__");
194
- //# sourceMappingURL=log.js.map
package/lib/log.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"log.js","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA4D;AAC5D,sDAAsD;AACtD,0DAA0D;AAC1D,0DAAuD;AACvD,oCAA8F;AAC9F,oDAA6L;AAC7L,oEAA0C;AAC1C,oDAAsE;AAEtE,SAAS,SAAS,CAAY,KAAe;IAC3C,OAAO,CAAC,GAAmB,EAAE,OAAuB,EAAE,GAAG,IAAW,EAAE,EAAE;QACtE,IAAI,GAAG,YAAY,KAAK,EAAE;YACxB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAA,mCAAsB,EAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;SACpG;aAAM;YACL,IAAI,OAAO,EAAE;gBACX,OAAO,IAAI,CAAC,KAAK,CAAC,IAAA,mCAAsB,EAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;aAC/G;iBAAM;gBACL,OAAO,IAAI,CAAC,KAAK,CAAC,IAAA,mCAAsB,EAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;aACjG;SACF;IACH,CAAC,C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CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC;AAE9C,6CAA6C;AAC7C,mDAAmD;AACnD,cAAc;AACd,OAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;AAExC,uCAAuC;AACvC,8BAA8B;AAC9B,2CAA2C;AAC3C,OAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,uBAAuB,CAAC,CAAC"}
@@ -1,87 +0,0 @@
1
- declare const CONFIGURATION_SCHEMA: {
2
- $id: string;
3
- $configurationModule: string;
4
- description: string;
5
- type: string;
6
- properties: {
7
- targets: {
8
- description: string;
9
- type: string;
10
- minItems: number;
11
- uniqueItems: boolean;
12
- items: {
13
- type: string;
14
- properties: {
15
- layout: {
16
- type: string;
17
- };
18
- name: {
19
- type: string;
20
- };
21
- type: {
22
- type: string;
23
- };
24
- enabled: {
25
- type: string;
26
- };
27
- path: {
28
- type: string;
29
- };
30
- archivePath: {
31
- type: string;
32
- };
33
- maxSize: {
34
- type: string;
35
- minimum: number;
36
- };
37
- compress: {
38
- type: string;
39
- };
40
- rotate: {
41
- type: string;
42
- };
43
- maxArchiveFiles: {
44
- type: string;
45
- minimum: number;
46
- };
47
- bufferSize: {
48
- type: string;
49
- minimum: number;
50
- };
51
- };
52
- required: string[];
53
- };
54
- };
55
- rules: {
56
- description: string;
57
- type: string;
58
- minItems: number;
59
- uniqueItems: boolean;
60
- items: {
61
- type: string;
62
- properties: {
63
- name: {
64
- type: string;
65
- };
66
- level: {
67
- type: string;
68
- enum: string[];
69
- };
70
- target: {
71
- oneOf: ({
72
- type: string;
73
- items?: undefined;
74
- } | {
75
- type: string;
76
- items: {
77
- type: string;
78
- };
79
- })[];
80
- };
81
- };
82
- required: string[];
83
- };
84
- };
85
- };
86
- };
87
- export default CONFIGURATION_SCHEMA;
@@ -1,92 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const CONFIGURATION_SCHEMA = {
4
- $id: "spinajs/log.configuration.schema.json",
5
- $configurationModule: "logger",
6
- description: "Logger configuration option validation",
7
- type: "object",
8
- properties: {
9
- targets: {
10
- description: "Log target, where log messages should be written to, and their options",
11
- type: "array",
12
- minItems: 1,
13
- uniqueItems: true,
14
- items: {
15
- type: "object",
16
- properties: {
17
- layout: {
18
- type: "string",
19
- },
20
- name: {
21
- type: "string",
22
- },
23
- type: {
24
- type: "string",
25
- },
26
- enabled: {
27
- type: "boolean",
28
- },
29
- path: {
30
- type: "string",
31
- },
32
- archivePath: {
33
- type: "string",
34
- },
35
- maxSize: {
36
- type: "integer",
37
- minimum: 10000,
38
- },
39
- compress: {
40
- type: "boolean",
41
- },
42
- rotate: {
43
- type: "string",
44
- },
45
- maxArchiveFiles: {
46
- type: "integer",
47
- minimum: 1,
48
- },
49
- bufferSize: {
50
- type: "integer",
51
- minimum: 1000,
52
- },
53
- },
54
- required: ["name", "type"],
55
- },
56
- },
57
- rules: {
58
- description: "Log rules, what log should be write where",
59
- type: "array",
60
- minItems: 1,
61
- uniqueItems: true,
62
- items: {
63
- type: "object",
64
- properties: {
65
- name: {
66
- type: "string",
67
- },
68
- level: {
69
- type: "string",
70
- enum: ["trace", "debug", "warn", "info", "error", "fatal", "security", "success"],
71
- },
72
- target: {
73
- oneOf: [
74
- {
75
- type: "string",
76
- },
77
- {
78
- type: "array",
79
- items: {
80
- type: "string",
81
- },
82
- },
83
- ],
84
- },
85
- },
86
- required: ["name", "level", "target"],
87
- },
88
- },
89
- },
90
- };
91
- exports.default = CONFIGURATION_SCHEMA;
92
- //# sourceMappingURL=log.configuration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"log.configuration.js","sourceRoot":"","sources":["../../src/schemas/log.configuration.ts"],"names":[],"mappings":";;AAAA,MAAM,oBAAoB,GAAG;IAC3B,GAAG,EAAE,uCAAuC;IAC5C,oBAAoB,EAAE,QAAQ;IAC9B,WAAW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MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,CAAC;qBAClF;oBACD,MAAM,EAAE;wBACN,KAAK,EAAE;4BACL;gCACE,IAAI,EAAE,QAAQ;6BACf;4BACD;gCACE,IAAI,EAAE,OAAO;gCACb,KAAK,EAAE;oCACL,IAAI,EAAE,QAAQ;iCACf;6BACF;yBACF;qBACF;iBACF;gBACD,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC;aACtC;SACF;KACF;CACF,CAAC;AAEF,kBAAe,oBAAoB,CAAC"}
@@ -1,7 +0,0 @@
1
- import { ICommonTargetOptions, LogTarget } from "@spinajs/log-common";
2
- /**
3
- * Empty writer, usefull for tests or when we dont want to get any messages
4
- */
5
- export declare class BlackHoleTarget extends LogTarget<ICommonTargetOptions> {
6
- write(): Promise<void>;
7
- }
@@ -1,25 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.BlackHoleTarget = void 0;
10
- const log_common_1 = require("@spinajs/log-common");
11
- const di_1 = require("@spinajs/di");
12
- /**
13
- * Empty writer, usefull for tests or when we dont want to get any messages
14
- */
15
- let BlackHoleTarget = class BlackHoleTarget extends log_common_1.LogTarget {
16
- async write() {
17
- return;
18
- }
19
- };
20
- BlackHoleTarget = __decorate([
21
- (0, di_1.Singleton)(),
22
- (0, di_1.Injectable)("BlackHoleTarget")
23
- ], BlackHoleTarget);
24
- exports.BlackHoleTarget = BlackHoleTarget;
25
- //# sourceMappingURL=BlackHoleTarget.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BlackHoleTarget.js","sourceRoot":"","sources":["../../src/targets/BlackHoleTarget.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAAsE;AACtE,oCAAoD;AAGpD;;GAEG;AAGH,IAAa,eAAe,GAA5B,MAAa,eAAgB,SAAQ,sBAA+B;IAC3D,KAAK,CAAC,KAAK;QAChB,OAAO;IACT,CAAC;CACF,CAAA;AAJY,eAAe;IAF3B,IAAA,cAAS,GAAE;IACX,IAAA,eAAU,EAAC,iBAAiB,CAAC;GACjB,eAAe,CAI3B;AAJY,0CAAe"}
@@ -1,50 +0,0 @@
1
- import { IColoredConsoleTargetOptions, ILogEntry, LogTarget } from "@spinajs/log-common";
2
- export declare const DEFAULT_THEME: {
3
- security: string[];
4
- fatal: string;
5
- error: string;
6
- warn: string;
7
- success: string;
8
- info: string;
9
- debug: string;
10
- trace: string;
11
- };
12
- export declare class ColoredConsoleTarget extends LogTarget<IColoredConsoleTargetOptions> {
13
- protected theme: any[];
14
- protected StdConsoleCallbackMap: {
15
- 5: {
16
- (...data: any[]): void;
17
- (message?: any, ...optionalParams: any[]): void;
18
- };
19
- 6: {
20
- (...data: any[]): void;
21
- (message?: any, ...optionalParams: any[]): void;
22
- };
23
- 999: {
24
- (...data: any[]): void;
25
- (message?: any, ...optionalParams: any[]): void;
26
- };
27
- 2: {
28
- (...data: any[]): void;
29
- (message?: any, ...optionalParams: any[]): void;
30
- };
31
- 3: {
32
- (...data: any[]): void;
33
- (message?: any, ...optionalParams: any[]): void;
34
- };
35
- 0: {
36
- (...data: any[]): void;
37
- (message?: any, ...optionalParams: any[]): void;
38
- };
39
- 1: {
40
- (...data: any[]): void;
41
- (message?: any, ...optionalParams: any[]): void;
42
- };
43
- 4: {
44
- (...data: any[]): void;
45
- (message?: any, ...optionalParams: any[]): void;
46
- };
47
- };
48
- resolve(): Promise<void>;
49
- write(data: ILogEntry): Promise<void>;
50
- }
@@ -1,71 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __importDefault = (this && this.__importDefault) || function (mod) {
9
- return (mod && mod.__esModule) ? mod : { "default": mod };
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ColoredConsoleTarget = exports.DEFAULT_THEME = void 0;
13
- const log_common_1 = require("@spinajs/log-common");
14
- const di_1 = require("@spinajs/di");
15
- const __1 = require("..");
16
- const chalk_1 = __importDefault(require("chalk"));
17
- const configuration_1 = require("@spinajs/configuration");
18
- exports.DEFAULT_THEME = {
19
- security: ["red", "bgBrightWhite"],
20
- fatal: "red",
21
- error: "brightRed",
22
- warn: "yellow",
23
- success: "green",
24
- info: "white",
25
- debug: "gray",
26
- trace: "gray",
27
- };
28
- let ColoredConsoleTarget = class ColoredConsoleTarget extends log_common_1.LogTarget {
29
- constructor() {
30
- super(...arguments);
31
- this.theme = [];
32
- this.StdConsoleCallbackMap = {
33
- [__1.LogLevel.Error]: console.error,
34
- [__1.LogLevel.Fatal]: console.error,
35
- [__1.LogLevel.Security]: console.error,
36
- [__1.LogLevel.Info]: console.log,
37
- [__1.LogLevel.Success]: console.log,
38
- [__1.LogLevel.Trace]: console.debug,
39
- [__1.LogLevel.Debug]: console.debug,
40
- [__1.LogLevel.Warn]: console.warn,
41
- };
42
- }
43
- async resolve() {
44
- this.theme[__1.LogLevel.Trace] = chalk_1.default.gray;
45
- this.theme[__1.LogLevel.Debug] = chalk_1.default.gray;
46
- this.theme[__1.LogLevel.Info] = chalk_1.default.white;
47
- this.theme[__1.LogLevel.Success] = chalk_1.default.white.bgGreen;
48
- this.theme[__1.LogLevel.Warn] = chalk_1.default.yellow;
49
- this.theme[__1.LogLevel.Error] = chalk_1.default.red;
50
- this.theme[__1.LogLevel.Fatal] = chalk_1.default.white.bgRed;
51
- this.theme[__1.LogLevel.Security] = chalk_1.default.yellow.bgRed;
52
- super.resolve();
53
- }
54
- async write(data) {
55
- if (!this.Options.enabled) {
56
- return;
57
- }
58
- this.StdConsoleCallbackMap[data.Level](
59
- /**
60
- * we are safe to call, disable eslint
61
- */
62
- /* eslint-disable */
63
- this.theme[data.Level]((0, configuration_1.format)(data.Variables, this.Options.layout)));
64
- }
65
- };
66
- ColoredConsoleTarget = __decorate([
67
- (0, di_1.Singleton)(),
68
- (0, di_1.Injectable)("ConsoleTarget")
69
- ], ColoredConsoleTarget);
70
- exports.ColoredConsoleTarget = ColoredConsoleTarget;
71
- //# sourceMappingURL=ColoredConsoleTarget.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ColoredConsoleTarget.js","sourceRoot":"","sources":["../../src/targets/ColoredConsoleTarget.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAyF;AACzF,oCAAoD;AACpD,0BAA8B;AAC9B,kDAA0B;AAC1B,0DAAgD;AAEnC,QAAA,aAAa,GAAG;IAC3B,QAAQ,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC;IAClC,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,WAAW;IAClB,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;CACd,CAAC;AAIF,IAAa,oBAAoB,GAAjC,MAAa,oBAAqB,SAAQ,sBAAuC;IAAjF;;QACY,UAAK,GAAU,EAAE,CAAC;QAElB,0BAAqB,GAAG;YAChC,CAAC,YAAQ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C,MAAM,CAAC,KAAK,CAAC;QAEnD,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;IAEM,KAAK,CAAC,KAAK,CAAC,IAAe;QAChC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACzB,OAAO;SACR;QAED,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC;QACpC;;WAEG;QACH,oBAAoB;QACnB,IAAI,CAAC,KAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAA,sBAAM,EAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAC7E,CAAC;IACJ,CAAC;CACF,CAAA;AA3CY,oBAAoB;IAFhC,IAAA,cAAS,GAAE;IACX,IAAA,eAAU,EAAC,eAAe,CAAC;GACf,oBAAoB,CA2ChC;AA3CY,oDAAoB"}
@@ -1,29 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { IInstanceCheck } from "@spinajs/di";
4
- import { IFileTargetOptions, ILog, ILogEntry, LogTarget } from "@spinajs/log-common";
5
- import * as fs from "fs";
6
- import "@spinajs/configuration-common";
7
- declare enum FileTargetStatus {
8
- WRITTING = 0,
9
- PENDING = 1,
10
- IDLE = 2
11
- }
12
- export declare class FileTarget extends LogTarget<IFileTargetOptions> implements IInstanceCheck {
13
- protected Log: ILog;
14
- LogDirPath: string;
15
- ArchiveDirPath: string;
16
- protected WriteStream: fs.WriteStream;
17
- protected Buffer: string[];
18
- protected ArchiveTimer: NodeJS.Timer;
19
- protected FlushTimer: NodeJS.Timer;
20
- protected Status: FileTargetStatus;
21
- protected ArchiveStatus: FileTargetStatus;
22
- __checkInstance__(creationOptions: IFileTargetOptions): boolean;
23
- resolve(): void;
24
- protected flush(): void;
25
- dispose(): Promise<void>;
26
- write(data: ILogEntry): Promise<void>;
27
- protected archive(): void;
28
- }
29
- export {};
@@ -1,250 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
- return c > 3 && r && Object.defineProperty(target, key, r), r;
23
- };
24
- var __importStar = (this && this.__importStar) || function (mod) {
25
- if (mod && mod.__esModule) return mod;
26
- var result = {};
27
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
- __setModuleDefault(result, mod);
29
- return result;
30
- };
31
- var __metadata = (this && this.__metadata) || function (k, v) {
32
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.FileTarget = void 0;
36
- /* eslint-disable security/detect-object-injection */
37
- const os_1 = require("os");
38
- /* eslint security/detect-non-literal-fs-filename:0 -- Safe as no value holds user input */
39
- const di_1 = require("@spinajs/di");
40
- const log_common_1 = require("@spinajs/log-common");
41
- const fs = __importStar(require("fs"));
42
- const path = __importStar(require("path"));
43
- const exceptions_1 = require("@spinajs/exceptions");
44
- const glob = __importStar(require("glob"));
45
- const zlib = __importStar(require("zlib"));
46
- const configuration_1 = require("@spinajs/configuration");
47
- const stream_1 = require("stream");
48
- const decorators_1 = require("./../decorators");
49
- require("@spinajs/configuration-common");
50
- var FileTargetStatus;
51
- (function (FileTargetStatus) {
52
- FileTargetStatus[FileTargetStatus["WRITTING"] = 0] = "WRITTING";
53
- FileTargetStatus[FileTargetStatus["PENDING"] = 1] = "PENDING";
54
- FileTargetStatus[FileTargetStatus["IDLE"] = 2] = "IDLE";
55
- })(FileTargetStatus || (FileTargetStatus = {}));
56
- // we mark per instance check becouse we can have multiple file targes
57
- // for different files/paths/logs but we dont want to create every time writer for same.
58
- let FileTarget = class FileTarget extends log_common_1.LogTarget {
59
- constructor() {
60
- super(...arguments);
61
- this.Buffer = [];
62
- this.Status = FileTargetStatus.IDLE;
63
- this.ArchiveStatus = FileTargetStatus.IDLE;
64
- }
65
- __checkInstance__(creationOptions) {
66
- return this.Options.name === creationOptions.name;
67
- }
68
- resolve() {
69
- this.Options.options = Object.assign({
70
- compress: true,
71
- maxSize: 1024 * 1024,
72
- maxArchiveFiles: 5,
73
- archiveInterval: 3 * 60,
74
- }, this.Options.options);
75
- this.LogDirPath = path.dirname(path.resolve((0, configuration_1.format)(null, this.Options.options.path)));
76
- this.ArchiveDirPath = this.Options.options.archivePath ? path.resolve((0, configuration_1.format)(null, this.Options.options.archivePath)) : this.LogDirPath;
77
- if (!this.LogDirPath) {
78
- throw new exceptions_1.InvalidOption("Missing LogDirPath log option");
79
- }
80
- if (!fs.existsSync(this.LogDirPath)) {
81
- fs.mkdirSync(this.LogDirPath);
82
- }
83
- if (this.ArchiveDirPath) {
84
- if (!fs.existsSync(this.ArchiveDirPath)) {
85
- fs.mkdirSync(this.ArchiveDirPath);
86
- }
87
- }
88
- // flush all buffered messages at least once per second
89
- // we do this, becouse buffer can not be filled
90
- // and we could wait unknown amount of time before messages are written to file
91
- this.FlushTimer = setInterval(() => {
92
- // do not flush, if we already writting to file
93
- if (this.Status !== FileTargetStatus.IDLE && this.ArchiveStatus !== FileTargetStatus.IDLE) {
94
- return;
95
- }
96
- setImmediate(() => {
97
- this.flush();
98
- });
99
- }, 1000);
100
- // every 3 minutes try to archive log files
101
- this.ArchiveTimer = setInterval(() => {
102
- // do not archive if we already doing it
103
- if (this.Status !== FileTargetStatus.IDLE && this.ArchiveStatus !== FileTargetStatus.IDLE) {
104
- return;
105
- }
106
- this.ArchiveStatus = FileTargetStatus.PENDING;
107
- // at end of nodejs event loop
108
- setImmediate(() => {
109
- this.archive();
110
- });
111
- }, this.Options.options.archiveInterval * 1000);
112
- super.resolve();
113
- }
114
- flush() {
115
- if (this.Buffer.length === 0) {
116
- this.Status = FileTargetStatus.IDLE;
117
- return;
118
- }
119
- this.Status = FileTargetStatus.WRITTING;
120
- // we calculate log path every time to allow for
121
- // dynamic path creation eg. based on timestamp
122
- const logFileName = (0, configuration_1.format)({ logger: this.Options.name }, path.basename(this.Options.options.path));
123
- const logPath = path.join(this.LogDirPath, logFileName);
124
- fs.appendFile(logPath, this.Buffer.join(os_1.EOL) + os_1.EOL, (err) => {
125
- // log error message to others if applicable eg. console
126
- if (err) {
127
- this.Log.error(err, `Cannot write log messages to file target at path ${logPath}`);
128
- }
129
- this.Log.trace(`Wrote buffered messages to log file at path ${logPath}, buffer size: ${this.Options.options.maxBufferSize}`);
130
- this.Buffer = [];
131
- this.Status = FileTargetStatus.IDLE;
132
- });
133
- }
134
- async dispose() {
135
- // stop archiving
136
- clearInterval(this.ArchiveTimer);
137
- // stop flush timer
138
- clearInterval(this.FlushTimer);
139
- // write all messages from buffer
140
- this.flush();
141
- }
142
- async write(data) {
143
- if (!this.Options.enabled) {
144
- return;
145
- }
146
- const lEntry = (0, configuration_1.format)(data.Variables, this.Options.layout);
147
- this.Buffer.push(lEntry);
148
- // if we already writting, skip buffer check & write to file
149
- // wait until write is finished
150
- if (this.Status !== FileTargetStatus.IDLE || this.ArchiveStatus !== FileTargetStatus.IDLE) {
151
- return;
152
- }
153
- if (this.Buffer.length >= this.Options.options.maxBufferSize) {
154
- this.Status = FileTargetStatus.PENDING;
155
- // write at end of nodejs event loop all buffered messages at once
156
- setImmediate(() => {
157
- this.flush();
158
- });
159
- }
160
- }
161
- archive() {
162
- const { ext } = path.parse(path.basename(this.Options.options.path));
163
- const aFiles = glob
164
- .sync(path.join(this.ArchiveDirPath, `archived_*{${ext},.gzip}`))
165
- .map((f) => {
166
- return {
167
- name: f,
168
- stat: fs.statSync(f),
169
- };
170
- })
171
- .sort((a, b) => a.stat.mtime.getTime() - b.stat.mtime.getTime());
172
- const lFiles = glob
173
- .sync(path.join(this.LogDirPath, `*${ext}`))
174
- .map((f) => {
175
- return {
176
- name: f,
177
- stat: fs.statSync(f),
178
- };
179
- })
180
- .sort((a, b) => a.stat.mtime.getTime() - b.stat.mtime.getTime());
181
- // clear archived files above limit
182
- if (aFiles.length > this.Options.options.maxArchiveFiles) {
183
- for (let i = 0; i < aFiles.length - this.Options.options.maxArchiveFiles; i++) {
184
- fs.unlink(aFiles[i].name, (err) => {
185
- if (err) {
186
- this.Log.error(err, `Cannot delete archived file at path ${aFiles[i - 1].name}`);
187
- }
188
- else {
189
- this.Log.info(`Deleted archived file at path ${aFiles[i].name}`);
190
- }
191
- });
192
- }
193
- }
194
- // now move log files that are above limited file size or old
195
- const filesToArchive = lFiles.filter((x) => {
196
- return x.stat.size > this.Options.options.maxSize || lFiles.indexOf(x) <= lFiles.length - 2;
197
- });
198
- if (filesToArchive.length === 0) {
199
- this.ArchiveStatus = FileTargetStatus.IDLE;
200
- }
201
- for (let i = 0; i < filesToArchive.length; i++) {
202
- const { name, ext } = path.parse(path.basename(lFiles[i].name));
203
- // get number of files with same name, eg. during a day, multiple log files can be produced
204
- const lArchiFiles = glob.sync(path.join(this.ArchiveDirPath, `archived_${name}*{${ext},.gzip}`));
205
- const archPath = path.join(this.ArchiveDirPath, `archived_${name}_${lArchiFiles.length + 1}${ext}`);
206
- fs.rename(lFiles[i].name, archPath, (err) => {
207
- if (err) {
208
- this.Log.error(err, `Cannot move log file ${name} to archive at path ${archPath}`);
209
- return;
210
- }
211
- if (this.Options.options.compress) {
212
- this.Log.trace(`Compressing archive log at path ${archPath}`);
213
- const zippedPath = path.join(this.ArchiveDirPath, `archived_${name}_${lArchiFiles.length + 1}${ext}.gzip`);
214
- const zip = zlib.createGzip();
215
- const read = fs.createReadStream(archPath);
216
- const write = fs.createWriteStream(zippedPath);
217
- (0, stream_1.pipeline)(read, zip, write, (err) => {
218
- if (err) {
219
- this.Log.error(err, `Cannot compress archived file at path ${archPath}`);
220
- fs.unlink(zippedPath, () => {
221
- return;
222
- });
223
- return;
224
- }
225
- this.Log.info(`Succesyfully compressed archive log at path ${zippedPath}`);
226
- fs.unlink(archPath, (err) => {
227
- if (err) {
228
- this.Log.error(err, `Cannot delete archived log after compression at path ${archPath}`);
229
- }
230
- });
231
- this.ArchiveStatus = FileTargetStatus.IDLE;
232
- });
233
- }
234
- else {
235
- this.ArchiveStatus = FileTargetStatus.IDLE;
236
- }
237
- });
238
- }
239
- }
240
- };
241
- __decorate([
242
- (0, decorators_1.Logger)("LogFileTarget"),
243
- __metadata("design:type", Object)
244
- ], FileTarget.prototype, "Log", void 0);
245
- FileTarget = __decorate([
246
- (0, di_1.PerInstanceCheck)(),
247
- (0, di_1.Injectable)("FileTarget")
248
- ], FileTarget);
249
- exports.FileTarget = FileTarget;
250
- //# sourceMappingURL=FileTarget.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FileTarget.js","sourceRoot":"","sources":["../../src/targets/FileTarget.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAqD;AACrD,2BAAyB;AACzB,2FAA2F;AAC3F,oCAA2E;AAC3E,oDAAqF;AACrF,uCAAyB;AACzB,2CAA6B;AAC7B,oDAAoD;AACpD,2CAA6B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C,CAAC;iBACJ;qBAAM;oBACL,IAAI,CAAC,aAAa,GAAG,gBAAgB,CAAC,IAAI,CAAC;iBAC5C;YACH,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;CACF,CAAA;AAxOC;IADC,IAAA,mBAAM,EAAC,eAAe,CAAC;;uCACJ;AAFT,UAAU;IAFtB,IAAA,qBAAgB,GAAE;IAClB,IAAA,eAAU,EAAC,YAAY,CAAC;GACZ,UAAU,CA0OtB;AA1OY,gCAAU"}
@@ -1,3 +0,0 @@
1
- export * from "./BlackHoleTarget";
2
- export * from "./ColoredConsoleTarget";
3
- export * from "./FileTarget";
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./BlackHoleTarget"), exports);
18
- __exportStar(require("./ColoredConsoleTarget"), exports);
19
- __exportStar(require("./FileTarget"), exports);
20
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/targets/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,yDAAuC;AACvC,+CAA6B"}
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.build.json",
3
-
4
- "compilerOptions": {
5
- "outDir": "./lib"
6
- },
7
-
8
- "include": ["src/**/*"]
9
- }