@spinajs/log 1.2.71 → 1.2.79
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/lib/bootstrap.js +4 -1
- package/lib/bootstrap.js.map +1 -1
- package/lib/index.js +5 -1
- package/lib/index.js.map +1 -1
- package/lib/log.js +9 -4
- package/lib/log.js.map +1 -1
- package/lib/targets/ColoredConsoleTarget.js +24 -1
- package/lib/targets/ColoredConsoleTarget.js.map +1 -1
- package/lib/targets/FileTarget.d.ts +5 -2
- package/lib/targets/FileTarget.js +64 -49
- package/lib/targets/FileTarget.js.map +1 -1
- package/lib/targets/LogTarget.js +24 -1
- package/lib/targets/LogTarget.js.map +1 -1
- package/lib/targets/index.js +5 -1
- package/lib/targets/index.js.map +1 -1
- package/package.json +6 -6
- package/lib/config/log.d.ts +0 -8
- package/lib/config/log.js +0 -15
- package/lib/config/log.js.map +0 -1
- package/lib/logger.d.ts +0 -4
- package/lib/logger.js +0 -30
- package/lib/logger.js.map +0 -1
- package/lib/types.d.ts +0 -148
- package/lib/types.js +0 -38
- package/lib/types.js.map +0 -1
- package/lib/variables/date.d.ts +0 -17
- package/lib/variables/date.js +0 -62
- package/lib/variables/date.js.map +0 -1
- package/lib/variables/env.d.ts +0 -5
- package/lib/variables/env.js +0 -25
- package/lib/variables/env.js.map +0 -1
- package/lib/variables/index.d.ts +0 -3
- package/lib/variables/index.js +0 -16
- package/lib/variables/index.js.map +0 -1
- package/lib/variables/process.d.ts +0 -5
- package/lib/variables/process.js +0 -24
- package/lib/variables/process.js.map +0 -1
- package/yarn-error.log +0 -2383
package/lib/bootstrap.js
CHANGED
|
@@ -5,12 +5,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
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
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
8
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
12
|
exports.LogBotstrapper = void 0;
|
|
10
13
|
const FileTarget_1 = require("./targets/FileTarget");
|
|
11
14
|
const di_1 = require("@spinajs/di");
|
|
12
15
|
const log_1 = require("./log");
|
|
13
|
-
const log_configuration_1 = require("./schemas/log.configuration");
|
|
16
|
+
const log_configuration_1 = __importDefault(require("./schemas/log.configuration"));
|
|
14
17
|
let LogBotstrapper = class LogBotstrapper extends di_1.Bootstrapper {
|
|
15
18
|
bootstrap() {
|
|
16
19
|
di_1.DI.register(log_configuration_1.default).asValue("__configurationSchema__");
|
package/lib/bootstrap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAkD;AAElD,oCAAuE;AACvE,+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,oCAAoC;QACpC,mCAAmC;QACnC,+CAA+C;QAC/C,OAAE,CAAC,QAAQ,CAAC,CAAC,SAAqB,EAAE,OAA2B,EAAE,EAAE;YACjE,MAAM,WAAW,GAAG,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC;YACxE,IAAI,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAa,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,IAAI,CAAe,CAAC;YAEhG,IAAI,CAAC,MAAM,EAAE;gBACX,MAAM,GAAG,SAAS,CAAC,OAAO,CAAa,gCAAgC,EAAC,CAAC,OAAO,CAAC,CAAC,CAAC;gBACnF,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;gBAE3D,OAAO,MAAM,CAAC;aACf;YAED,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC;QAEpB,OAAE,CAAC,QAAQ,CAAC,uBAAU,CAAC,CAAC,EAAE,CAAC,gCAAgC,CAAC,CAAC;QAE7D,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,GAAG,EAAE,EAAE;YACtC,MAAM,GAAG,GAAG,OAAE,CAAC,OAAO,CAAC,SAAG,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;YACzC,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,6BAA6B,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC7C,MAAM,GAAG,GAAG,OAAE,CAAC,OAAO,CAAC,SAAG,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;YACzC,GAAG,CAAC,KAAK,CAAC,MAAe,EAAE,mCAAmC,EAAE,CAAC,CAAC,CAAC;QACrE,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAjCY,cAAc;IAD1B,IAAA,eAAU,EAAC,iBAAY,CAAC;GACZ,cAAc,CAiC1B;AAjCY,wCAAc"}
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
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.js
CHANGED
|
@@ -8,16 +8,19 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
var Log_1;
|
|
12
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
16
|
exports.Log = void 0;
|
|
14
17
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
15
18
|
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
16
19
|
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
17
|
-
const
|
|
20
|
+
const configuration_1 = require("@spinajs/configuration");
|
|
18
21
|
const di_1 = require("@spinajs/di");
|
|
19
22
|
const log_common_1 = require("@spinajs/log-common");
|
|
20
|
-
const
|
|
23
|
+
const glob_to_regexp_1 = __importDefault(require("glob-to-regexp"));
|
|
21
24
|
const exceptions_1 = require("@spinajs/exceptions");
|
|
22
25
|
function wrapWrite(level) {
|
|
23
26
|
return (err, message, ...args) => {
|
|
@@ -68,7 +71,7 @@ let Log = Log_1 = class Log extends di_1.SyncModule {
|
|
|
68
71
|
return 0;
|
|
69
72
|
}
|
|
70
73
|
resolve() {
|
|
71
|
-
const config = this.Container.get(
|
|
74
|
+
const config = this.Container.get(configuration_1.Configuration);
|
|
72
75
|
if (!config) {
|
|
73
76
|
throw new Error(`Configuration module is not avaible. Please resolve configuration module before any logging can occur`);
|
|
74
77
|
}
|
|
@@ -141,7 +144,9 @@ let Log = Log_1 = class Log extends di_1.SyncModule {
|
|
|
141
144
|
}
|
|
142
145
|
matchRulesToLogger() {
|
|
143
146
|
this.Rules = this.Options.rules.filter((r) => {
|
|
144
|
-
|
|
147
|
+
const g = (0, glob_to_regexp_1.default)(r.name);
|
|
148
|
+
// BUG: g.test throws vscode err ?
|
|
149
|
+
return g.test(this.Name);
|
|
145
150
|
});
|
|
146
151
|
}
|
|
147
152
|
};
|
package/lib/log.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA4D;AAC5D,sDAAsD;AACtD,0DAA0D;AAC1D,0DAAuD;AACvD,oCAA6F;AAE7F,oDAAkK;AAClK,oEAA0C;AAC1C,oDAAoD;AAEpD,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,OAA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;AAiLhB,MAAM,kBAAkB,GAAG,CAAC,SAAqB,EAAE,OAAe,EAAE,EAAE;IACpE,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;QAC5B,OAAO,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;KACjC;IAED,OAAO,SAAS,CAAC,OAAO,CAAC,uBAAuB,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;AAC/D,CAAC,CAAC;AAEF,6CAA6C;AAC7C,2CAA2C;AAC3C,2DAA2D;AAC3D,2CAA2C;AAC3C,OAAE,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,17 +1,40 @@
|
|
|
1
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
|
+
});
|
|
2
18
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
19
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
20
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
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;
|
|
6
22
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
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
|
+
};
|
|
8
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
32
|
exports.ColoredConsoleTarget = exports.DEFAULT_THEME = void 0;
|
|
10
33
|
const log_common_1 = require("@spinajs/log-common");
|
|
11
34
|
const di_1 = require("@spinajs/di");
|
|
12
35
|
const LogTarget_1 = require("./LogTarget");
|
|
13
36
|
const __1 = require("..");
|
|
14
|
-
const colors = require("colors/safe");
|
|
37
|
+
const colors = __importStar(require("colors/safe"));
|
|
15
38
|
const configuration_1 = require("@spinajs/configuration");
|
|
16
39
|
exports.DEFAULT_THEME = {
|
|
17
40
|
security: ["red", "bgBrightWhite"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColoredConsoleTarget.js","sourceRoot":"","sources":["../../src/targets/ColoredConsoleTarget.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ColoredConsoleT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K,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,MAAc,CAAC,4BAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAC1C,IAAA,sBAAM,EAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAC5C,CACF,CAAC;IACJ,CAAC;CACF,CAAA;AAnCY,oBAAoB;IAFhC,IAAA,cAAS,GAAE;IACX,IAAA,eAAU,EAAC,eAAe,CAAC;GACf,oBAAoB,CAmChC;AAnCY,oDAAoB"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { LogTarget } from "./LogTarget";
|
|
2
3
|
import { IFileTargetOptions, ILogEntry } from "@spinajs/log-common";
|
|
4
|
+
import * as fs from "fs";
|
|
3
5
|
import { Job } from "node-schedule";
|
|
4
6
|
export declare class FileTarget extends LogTarget<IFileTargetOptions> {
|
|
5
7
|
protected LogDirPath: string;
|
|
@@ -10,14 +12,15 @@ export declare class FileTarget extends LogTarget<IFileTargetOptions> {
|
|
|
10
12
|
protected ArchiveDirPath: string;
|
|
11
13
|
protected RotateJob: Job;
|
|
12
14
|
protected ArchiveJob: Job;
|
|
13
|
-
protected LogFileDescriptor: number;
|
|
14
15
|
protected CurrentFileSize: number;
|
|
15
16
|
protected BufferSize: number;
|
|
17
|
+
protected FlushTimeout: NodeJS.Timeout;
|
|
16
18
|
protected Buffer: any[];
|
|
19
|
+
protected WriteStream: fs.WriteStream;
|
|
17
20
|
resolve(): void;
|
|
18
21
|
write(data: ILogEntry): Promise<void>;
|
|
19
22
|
protected archive(): void;
|
|
20
|
-
protected flush(): void;
|
|
21
23
|
private rotate;
|
|
22
24
|
private initialize;
|
|
25
|
+
private reopenStream;
|
|
23
26
|
}
|
|
@@ -1,24 +1,47 @@
|
|
|
1
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
|
+
});
|
|
2
18
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
19
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
20
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
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;
|
|
6
22
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
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
|
+
};
|
|
8
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
32
|
exports.FileTarget = void 0;
|
|
10
|
-
const internal_logger_1 = require("@spinajs/internal-logger");
|
|
11
33
|
/* eslint security/detect-non-literal-fs-filename:0 -- Safe as no value holds user input */
|
|
12
34
|
const di_1 = require("@spinajs/di");
|
|
13
35
|
const LogTarget_1 = require("./LogTarget");
|
|
14
|
-
const fs = require("fs");
|
|
15
|
-
const path = require("path");
|
|
36
|
+
const fs = __importStar(require("fs"));
|
|
37
|
+
const path = __importStar(require("path"));
|
|
16
38
|
const node_schedule_1 = require("node-schedule");
|
|
17
39
|
const exceptions_1 = require("@spinajs/exceptions");
|
|
18
40
|
const os_1 = require("os");
|
|
19
|
-
const glob = require("glob");
|
|
20
|
-
const zlib = require("zlib");
|
|
41
|
+
const glob = __importStar(require("glob"));
|
|
42
|
+
const zlib = __importStar(require("zlib"));
|
|
21
43
|
const configuration_1 = require("@spinajs/configuration");
|
|
44
|
+
const console_1 = require("console");
|
|
22
45
|
let FileTarget = class FileTarget extends LogTarget_1.LogTarget {
|
|
23
46
|
constructor() {
|
|
24
47
|
super(...arguments);
|
|
@@ -35,12 +58,6 @@ let FileTarget = class FileTarget extends LogTarget_1.LogTarget {
|
|
|
35
58
|
}, this.Options.options);
|
|
36
59
|
this.initialize();
|
|
37
60
|
this.rotate();
|
|
38
|
-
process.on("exit", () => {
|
|
39
|
-
this.flush();
|
|
40
|
-
if (this.LogFileDescriptor) {
|
|
41
|
-
fs.closeSync(this.LogFileDescriptor);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
61
|
super.resolve();
|
|
45
62
|
}
|
|
46
63
|
write(data) {
|
|
@@ -48,11 +65,17 @@ let FileTarget = class FileTarget extends LogTarget_1.LogTarget {
|
|
|
48
65
|
return;
|
|
49
66
|
}
|
|
50
67
|
const result = (0, configuration_1.format)(data.Variables, this.Options.layout) + os_1.EOL;
|
|
51
|
-
|
|
52
|
-
this.
|
|
53
|
-
this.
|
|
54
|
-
|
|
55
|
-
|
|
68
|
+
this.CurrentFileSize += Buffer.byteLength(result);
|
|
69
|
+
(0, console_1.assert)(this.WriteStream, "write stream is not created");
|
|
70
|
+
const ok = this.WriteStream.write(result, (err) => {
|
|
71
|
+
if (err) {
|
|
72
|
+
console.debug(`Cannot write to log stream at path ${this.LogPath}`);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
if (!ok) {
|
|
76
|
+
this.WriteStream.once("drain", () => {
|
|
77
|
+
void this.write(data);
|
|
78
|
+
});
|
|
56
79
|
}
|
|
57
80
|
if (this.CurrentFileSize > this.Options.options.maxSize) {
|
|
58
81
|
this.archive();
|
|
@@ -71,11 +94,9 @@ let FileTarget = class FileTarget extends LogTarget_1.LogTarget {
|
|
|
71
94
|
const newestFile = files.length !== 0 ? files[files.length - 1].name : undefined;
|
|
72
95
|
const fIndex = newestFile ? parseInt(newestFile.substring(newestFile.lastIndexOf("_") + 1, newestFile.lastIndexOf("_") + 2), 10) + 1 : 1;
|
|
73
96
|
const archPath = path.join(this.ArchiveDirPath, `archived_${this.LogBaseName}_${fIndex}${this.LogFileExt}`);
|
|
74
|
-
this.flush();
|
|
75
97
|
if (!fs.existsSync(this.LogPath)) {
|
|
76
98
|
return;
|
|
77
99
|
}
|
|
78
|
-
fs.closeSync(this.LogFileDescriptor);
|
|
79
100
|
fs.copyFileSync(this.LogPath, archPath);
|
|
80
101
|
fs.unlinkSync(this.LogPath);
|
|
81
102
|
this.initialize();
|
|
@@ -93,27 +114,13 @@ let FileTarget = class FileTarget extends LogTarget_1.LogTarget {
|
|
|
93
114
|
return;
|
|
94
115
|
});
|
|
95
116
|
});
|
|
96
|
-
internal_logger_1.InternalLogger.debug(`Created archived compressed file at ${zippedPath}`, "file-target");
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
internal_logger_1.InternalLogger.debug(`Created archived file at ${archPath}`, "file-target");
|
|
100
117
|
}
|
|
101
118
|
if (files.length >= this.Options.options.maxArchiveFiles) {
|
|
102
|
-
internal_logger_1.InternalLogger.debug(`Deleting old archive file ${files[0].name}`, "file-target");
|
|
103
119
|
fs.unlink(files[0].name, () => {
|
|
104
120
|
return;
|
|
105
121
|
});
|
|
106
122
|
}
|
|
107
123
|
}
|
|
108
|
-
flush() {
|
|
109
|
-
if (!this.LogFileDescriptor || this.HasError || this.BufferSize === 0) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
fs.writeFileSync(this.LogFileDescriptor, this.Buffer.join());
|
|
113
|
-
this.CurrentFileSize += this.BufferSize;
|
|
114
|
-
this.Buffer = [];
|
|
115
|
-
this.BufferSize = 0;
|
|
116
|
-
}
|
|
117
124
|
rotate() {
|
|
118
125
|
if (this.Options.options.rotate) {
|
|
119
126
|
this.RotateJob = (0, node_schedule_1.scheduleJob)(`LogScheduleJob`, this.Options.options.rotate, () => {
|
|
@@ -122,11 +129,6 @@ let FileTarget = class FileTarget extends LogTarget_1.LogTarget {
|
|
|
122
129
|
}
|
|
123
130
|
}
|
|
124
131
|
initialize() {
|
|
125
|
-
this.flush();
|
|
126
|
-
if (this.LogFileDescriptor >= 0) {
|
|
127
|
-
fs.closeSync(this.LogFileDescriptor);
|
|
128
|
-
this.LogFileDescriptor = 0;
|
|
129
|
-
}
|
|
130
132
|
this.CurrentFileSize = 0;
|
|
131
133
|
this.LogDirPath = path.dirname(path.resolve((0, configuration_1.format)(null, this.Options.options.path)));
|
|
132
134
|
this.ArchiveDirPath = this.Options.options.archivePath ? path.resolve((0, configuration_1.format)(null, this.Options.options.archivePath)) : this.LogDirPath;
|
|
@@ -146,22 +148,35 @@ let FileTarget = class FileTarget extends LogTarget_1.LogTarget {
|
|
|
146
148
|
fs.mkdirSync(this.ArchiveDirPath);
|
|
147
149
|
}
|
|
148
150
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
151
|
+
this.reopenStream();
|
|
152
|
+
}
|
|
153
|
+
reopenStream() {
|
|
154
|
+
if (this.WriteStream) {
|
|
155
|
+
this.WriteStream.removeAllListeners();
|
|
156
|
+
this.WriteStream.close((err) => {
|
|
157
|
+
console.debug(`Cannot close log write stream ${this.LogPath}, reason: ${err.message}`);
|
|
158
|
+
});
|
|
159
|
+
this.WriteStream = null;
|
|
158
160
|
}
|
|
159
|
-
this.
|
|
160
|
-
|
|
161
|
+
this.WriteStream = fs.createWriteStream(this.LogPath, {
|
|
162
|
+
flags: "a",
|
|
163
|
+
encoding: "utf-8",
|
|
164
|
+
});
|
|
165
|
+
this.WriteStream.on("open", () => {
|
|
166
|
+
console.debug(`Opend log write stream at ${this.LogPath}`);
|
|
167
|
+
});
|
|
168
|
+
this.WriteStream.on("error", (err) => {
|
|
169
|
+
console.debug(`Cannot create log file write steram at path ${this.LogPath}, reason: ${err.message}`);
|
|
170
|
+
this.reopenStream();
|
|
171
|
+
});
|
|
172
|
+
this.WriteStream.on("close", () => {
|
|
173
|
+
console.debug(`Closed log write stream at ${this.LogPath}`);
|
|
174
|
+
});
|
|
161
175
|
}
|
|
162
176
|
};
|
|
163
177
|
FileTarget = __decorate([
|
|
164
|
-
(0, di_1.NewInstance)()
|
|
178
|
+
(0, di_1.NewInstance)(),
|
|
179
|
+
(0, di_1.Injectable)("FileTarget")
|
|
165
180
|
], FileTarget);
|
|
166
181
|
exports.FileTarget = FileTarget;
|
|
167
182
|
//# sourceMappingURL=FileTarget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileTarget.js","sourceRoot":"","sources":["../../src/targets/FileTarget.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FileTarget.js","sourceRoot":"","sources":["../../src/targets/FileTarget.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2FAA2F;AAC3F,oCAAsD;AACtD,2CAAwC;AAExC,uCAAyB;AACzB,2CAA6B;AAC7B,iDAA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,EAAE,CAAC,GAAG,EAAE,EAAE;YACnC,OAAO,CAAC,KAAK,CAAC,+CAA+C,IAAI,CAAC,OAAO,aAAa,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;YAErG,IAAI,CAAC,YAAY,EAAE,CAAC;QACtB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;YAChC,OAAO,CAAC,KAAK,CAAC,8BAA8B,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AApLY,UAAU;IAFtB,IAAA,gBAAW,GAAE;IACb,IAAA,eAAU,EAAC,YAAY,CAAC;GACZ,UAAU,CAoLtB;AApLY,gCAAU"}
|
package/lib/targets/LogTarget.js
CHANGED
|
@@ -1,8 +1,31 @@
|
|
|
1
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 __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.LogTarget = void 0;
|
|
4
27
|
const di_1 = require("@spinajs/di");
|
|
5
|
-
const _ = require("lodash");
|
|
28
|
+
const _ = __importStar(require("lodash"));
|
|
6
29
|
class LogTarget extends di_1.SyncModule {
|
|
7
30
|
constructor(options) {
|
|
8
31
|
super();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogTarget.js","sourceRoot":"","sources":["../../src/targets/LogTarget.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LogTarget.js","sourceRoot":"","sources":["../../src/targets/LogTarget.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAAyC;AACzC,0CAA4B;AAS5B,MAAsB,SAA0C,SAAQ,eAAU;IAKhF,YAAY,OAAU;QACpB,KAAK,EAAE,CAAC;QALH,aAAQ,GAAG,KAAK,CAAC;QACjB,UAAK,GAA2B,IAAI,CAAC;QAM1C,IAAI,OAAO,EAAE;YACX,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,KAAK,CACpB,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE;gBACpB,OAAO,EAAE,IAAI;gBACb,MAAM,EAAE,sDAAsD;aAC/D,CAAC,EACF,OAAO,CACR,CAAC;SACH;IACH,CAAC;CAGF;AApBD,8BAoBC"}
|
package/lib/targets/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/lib/targets/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/targets/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/targets/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,yDAAuC;AACvC,+CAA6B;AAC7B,8CAA4B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spinajs/log",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.79",
|
|
4
4
|
"description": "Log lib for all spinejs related libs",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"private": false,
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
},
|
|
27
27
|
"homepage": "https://github.com/spinajs/log#readme",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@spinajs/configuration": "^1.2.
|
|
30
|
-
"@spinajs/di": "^1.2.
|
|
31
|
-
"@spinajs/exceptions": "^1.2.
|
|
32
|
-
"@spinajs/log-common": "^1.2.
|
|
29
|
+
"@spinajs/configuration": "^1.2.79",
|
|
30
|
+
"@spinajs/di": "^1.2.79",
|
|
31
|
+
"@spinajs/exceptions": "^1.2.79",
|
|
32
|
+
"@spinajs/log-common": "^1.2.79",
|
|
33
33
|
"ajv": "^8.8.2",
|
|
34
34
|
"colors": "^1.4.0",
|
|
35
35
|
"glob": "^7.2.0",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/color": "^3.0.3"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "ae595f5daffb88372496b6e5bf38973f07e33683"
|
|
45
45
|
}
|
package/lib/config/log.d.ts
DELETED
package/lib/config/log.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const path_1 = require("path");
|
|
4
|
-
function dir(path) {
|
|
5
|
-
return (0, path_1.resolve)((0, path_1.normalize)((0, path_1.join)(__dirname, path)));
|
|
6
|
-
}
|
|
7
|
-
const config = {
|
|
8
|
-
system: {
|
|
9
|
-
dirs: {
|
|
10
|
-
schemas: [dir("./../schemas")],
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
exports.default = config;
|
|
15
|
-
//# sourceMappingURL=log.js.map
|
package/lib/config/log.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/config/log.ts"],"names":[],"mappings":";;AAAA,+BAAgD;AAEhD,SAAS,GAAG,CAAC,IAAY;IACvB,OAAO,IAAA,cAAO,EAAC,IAAA,gBAAS,EAAC,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,MAAM,GAAG;IACb,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,OAAO,EAAE,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;SAC/B;KACF;CACF,CAAC;AAEF,kBAAe,MAAM,CAAC"}
|
package/lib/logger.d.ts
DELETED
package/lib/logger.js
DELETED
|
@@ -1,30 +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.Logger = void 0;
|
|
10
|
-
const di_1 = require("@spinajs/di");
|
|
11
|
-
const log_1 = require("./log");
|
|
12
|
-
const log_configuration_1 = require("./schemas/log.configuration");
|
|
13
|
-
let Logger = class Logger extends di_1.Bootstrapper {
|
|
14
|
-
async bootstrap() {
|
|
15
|
-
di_1.DI.register(log_configuration_1.default).asValue("__configurationSchema__");
|
|
16
|
-
process.on("uncaughtException", (err) => {
|
|
17
|
-
const log = di_1.DI.resolve(log_1.Log, ["process"]);
|
|
18
|
-
log.fatal(err, "Unhandled exception occured");
|
|
19
|
-
});
|
|
20
|
-
process.on("unhandledRejection", (reason, p) => {
|
|
21
|
-
const log = di_1.DI.resolve(log_1.Log, ["process"]);
|
|
22
|
-
log.fatal(reason, "Unhandled rejection at Promise %s", p);
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
Logger = __decorate([
|
|
27
|
-
di_1.Autoinject
|
|
28
|
-
], Logger);
|
|
29
|
-
exports.Logger = Logger;
|
|
30
|
-
//# sourceMappingURL=logger.js.map
|
package/lib/logger.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oCAA2D;AAC3D,+BAA4B;AAC5B,mEAA+D;AAG/D,IAAa,MAAM,GAAnB,MAAa,MAAO,SAAQ,iBAAY;IAC/B,KAAK,CAAC,SAAS;QACpB,OAAE,CAAC,QAAQ,CAAC,2BAAoB,CAAC,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;QAErE,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,GAAG,EAAE,EAAE;YACtC,MAAM,GAAG,GAAG,OAAE,CAAC,OAAO,CAAC,SAAG,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;YACzC,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,6BAA6B,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC7C,MAAM,GAAG,GAAG,OAAE,CAAC,OAAO,CAAC,SAAG,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;YACzC,GAAG,CAAC,KAAK,CAAC,MAAe,EAAE,mCAAmC,EAAE,CAAC,CAAC,CAAC;QACrE,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAdY,MAAM;IADlB,eAAU;GACE,MAAM,CAclB;AAdY,wBAAM"}
|