@spinajs/log 1.0.9 → 1.1.5
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/config/log.d.ts +9 -0
- package/lib/config/log.js +16 -0
- package/lib/config/log.js.map +1 -0
- package/lib/decorators.d.ts +6 -0
- package/lib/decorators.js +37 -0
- package/lib/decorators.js.map +1 -0
- package/lib/index.d.ts +5 -227
- package/lib/index.js +7 -200
- package/lib/index.js.map +1 -1
- package/lib/log.d.ts +70 -0
- package/lib/log.js +218 -0
- package/lib/log.js.map +1 -0
- package/lib/logger.d.ts +8 -0
- package/lib/logger.js +40 -0
- package/lib/logger.js.map +1 -0
- package/lib/schemas/log.configuration.d.ts +115 -0
- package/lib/schemas/log.configuration.js +136 -0
- package/lib/schemas/log.configuration.js.map +1 -0
- package/lib/targets/BlackHoleTarget.d.ts +8 -0
- package/lib/targets/BlackHoleTarget.js +25 -0
- package/lib/targets/BlackHoleTarget.js.map +1 -0
- package/lib/targets/ColoredConsoleTarget.d.ts +51 -0
- package/lib/targets/ColoredConsoleTarget.js +57 -0
- package/lib/targets/ColoredConsoleTarget.js.map +1 -0
- package/lib/targets/FileTarget.d.ts +24 -0
- package/lib/targets/FileTarget.js +193 -0
- package/lib/targets/FileTarget.js.map +1 -0
- package/lib/targets/LogTarget.d.ts +14 -0
- package/lib/targets/LogTarget.js +79 -0
- package/lib/targets/LogTarget.js.map +1 -0
- package/lib/targets/index.d.ts +3 -0
- package/lib/targets/index.js +16 -0
- package/lib/targets/index.js.map +1 -0
- package/lib/types.d.ts +145 -0
- package/lib/types.js +38 -0
- package/lib/types.js.map +1 -0
- package/lib/variables/date.d.ts +17 -0
- package/lib/variables/date.js +62 -0
- package/lib/variables/date.js.map +1 -0
- package/lib/variables/env.d.ts +5 -0
- package/lib/variables/env.js +25 -0
- package/lib/variables/env.js.map +1 -0
- package/lib/variables/index.d.ts +3 -0
- package/lib/variables/index.js +16 -0
- package/lib/variables/index.js.map +1 -0
- package/lib/variables/process.d.ts +6 -0
- package/lib/variables/process.js +36 -0
- package/lib/variables/process.js.map +1 -0
- package/package.json +21 -8
- package/yarn-error.log +2304 -13
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TimeLogVariable = exports.DateLogVariable = exports.DateTimeLogVariable = void 0;
|
|
13
|
+
const di_1 = require("@spinajs/di");
|
|
14
|
+
const luxon_1 = require("luxon");
|
|
15
|
+
const types_1 = require("../types");
|
|
16
|
+
let DateTimeLogVariable = class DateTimeLogVariable extends types_1.LogVariable {
|
|
17
|
+
get Name() {
|
|
18
|
+
return "datetime";
|
|
19
|
+
}
|
|
20
|
+
Value(option) {
|
|
21
|
+
return luxon_1.DateTime.now().toFormat(option !== null && option !== void 0 ? option : "dd/MM/yyyy HH:mm:ss.SSS ZZ");
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
DateTimeLogVariable = __decorate([
|
|
25
|
+
(0, di_1.Injectable)(types_1.LogVariable)
|
|
26
|
+
], DateTimeLogVariable);
|
|
27
|
+
exports.DateTimeLogVariable = DateTimeLogVariable;
|
|
28
|
+
let DateLogVariable = class DateLogVariable extends types_1.LogVariable {
|
|
29
|
+
constructor(format) {
|
|
30
|
+
super();
|
|
31
|
+
this.format = format;
|
|
32
|
+
}
|
|
33
|
+
get Name() {
|
|
34
|
+
return "date";
|
|
35
|
+
}
|
|
36
|
+
Value(option) {
|
|
37
|
+
return luxon_1.DateTime.now().toFormat(option !== null && option !== void 0 ? option : "dd/MM/yyyy");
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
DateLogVariable = __decorate([
|
|
41
|
+
(0, di_1.Injectable)(types_1.LogVariable),
|
|
42
|
+
__metadata("design:paramtypes", [String])
|
|
43
|
+
], DateLogVariable);
|
|
44
|
+
exports.DateLogVariable = DateLogVariable;
|
|
45
|
+
let TimeLogVariable = class TimeLogVariable extends types_1.LogVariable {
|
|
46
|
+
constructor(format) {
|
|
47
|
+
super();
|
|
48
|
+
this.format = format;
|
|
49
|
+
}
|
|
50
|
+
get Name() {
|
|
51
|
+
return "time";
|
|
52
|
+
}
|
|
53
|
+
Value(option) {
|
|
54
|
+
return luxon_1.DateTime.now().toFormat(option !== null && option !== void 0 ? option : "HH:mm:ss.SSS");
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
TimeLogVariable = __decorate([
|
|
58
|
+
(0, di_1.Injectable)(types_1.LogVariable),
|
|
59
|
+
__metadata("design:paramtypes", [String])
|
|
60
|
+
], TimeLogVariable);
|
|
61
|
+
exports.TimeLogVariable = TimeLogVariable;
|
|
62
|
+
//# sourceMappingURL=date.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../src/variables/date.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oCAAyC;AACzC,iCAAiC;AACjC,oCAAuC;AAIvC,IAAa,mBAAmB,GAAhC,MAAa,mBAAoB,SAAQ,mBAAW;IAChD,IAAW,IAAI;QACX,OAAO,UAAU,CAAC;IACtB,CAAC;IACM,KAAK,CAAC,M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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.EnvVariable = void 0;
|
|
10
|
+
const di_1 = require("@spinajs/di");
|
|
11
|
+
const types_1 = require("../types");
|
|
12
|
+
let EnvVariable = class EnvVariable extends types_1.LogVariable {
|
|
13
|
+
get Name() {
|
|
14
|
+
return "env";
|
|
15
|
+
}
|
|
16
|
+
Value(option) {
|
|
17
|
+
var _a;
|
|
18
|
+
return (_a = process.env[option]) !== null && _a !== void 0 ? _a : "";
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
EnvVariable = __decorate([
|
|
22
|
+
(0, di_1.Injectable)(types_1.LogVariable)
|
|
23
|
+
], EnvVariable);
|
|
24
|
+
exports.EnvVariable = EnvVariable;
|
|
25
|
+
//# sourceMappingURL=env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/variables/env.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oCAAyC;AACzC,oCAAuC;AAIvC,IAAa,WAAW,GAAxB,MAAa,WAAY,SAAQ,mBAAW;IACxC,IAAW,IAAI;QACX,OAAO,KAAK,CAAC;IACjB,CAAC;IACM,KAAK,CAAC,MAAc;;QACvB,OAAO,MAAA,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,mCAAI,EAAE,CAAC;IACrC,CAAC;CACJ,CAAA;AAPY,WAAW;IADvB,IAAA,eAAU,EAAC,mBAAW,CAAC;GACX,WAAW,CAOvB;AAPY,kCAAW"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./date"), exports);
|
|
14
|
+
__exportStar(require("./env"), exports);
|
|
15
|
+
__exportStar(require("./process"), exports);
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/variables/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAuB;AACvB,wCAAsB;AACtB,4CAA0B"}
|
|
@@ -0,0 +1,36 @@
|
|
|
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.ProcVariable = void 0;
|
|
10
|
+
const di_1 = require("@spinajs/di");
|
|
11
|
+
const types_1 = require("../types");
|
|
12
|
+
let ProcVariable = class ProcVariable extends types_1.LogVariable {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.ALLOWED_PROPS = [
|
|
16
|
+
"title",
|
|
17
|
+
"version",
|
|
18
|
+
"pid",
|
|
19
|
+
"platform",
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
get Name() {
|
|
23
|
+
return "proc";
|
|
24
|
+
}
|
|
25
|
+
Value(option) {
|
|
26
|
+
if (this.ALLOWED_PROPS.indexOf(option) !== -1) {
|
|
27
|
+
return process[option];
|
|
28
|
+
}
|
|
29
|
+
return `[${option} is undefined]`;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
ProcVariable = __decorate([
|
|
33
|
+
(0, di_1.Injectable)(types_1.LogVariable)
|
|
34
|
+
], ProcVariable);
|
|
35
|
+
exports.ProcVariable = ProcVariable;
|
|
36
|
+
//# sourceMappingURL=process.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.js","sourceRoot":"","sources":["../../src/variables/process.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oCAAyC;AACzC,oCAAuC;AAIvC,IAAa,YAAY,GAAzB,MAAa,YAAa,SAAQ,mBAAW;IAA7C;;QAEc,kBAAa,GAAG;YACtB,OAAO;YACP,SAAS;YACT,KAAK;YACL,UAAU;SAEb,CAAA;IAaL,CAAC;IAZG,IAAW,IAAI;QACX,OAAO,MAAM,CAAC;IAClB,CAAC;IACM,KAAK,CAAC,MAAc;QAEvB,IAAI,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE;YAC3C,OAAQ,OAAe,CAAC,MAAM,CAAC,CAAC;SACnC;QAED,OAAO,IAAI,MAAM,gBAAgB,CAAC;IACtC,CAAC;CAEJ,CAAA;AArBY,YAAY;IADxB,IAAA,eAAU,EAAC,mBAAW,CAAC;GACX,YAAY,CAqBxB;AArBY,oCAAY"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spinajs/log",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "Log lib for all spinejs related libs",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"private": false,
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"coverage": "nyc npm run test",
|
|
10
10
|
"build-docs": "rimraf docs && typedoc --options typedoc.json src/",
|
|
11
11
|
"build": "tsc",
|
|
12
|
+
"build-watch": "tsc -w",
|
|
12
13
|
"prepare": "npm run build",
|
|
13
14
|
"format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
|
|
14
15
|
"lint": "tslint -p tsconfig.json",
|
|
@@ -24,26 +25,38 @@
|
|
|
24
25
|
},
|
|
25
26
|
"homepage": "https://github.com/spinajs/log#readme",
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"@spinajs/configuration": "^1.
|
|
28
|
-
"@spinajs/di": "^1.
|
|
29
|
-
"@spinajs/exceptions": "^1.0.
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
28
|
+
"@spinajs/configuration": "^1.1.6",
|
|
29
|
+
"@spinajs/di": "^1.1.7",
|
|
30
|
+
"@spinajs/exceptions": "^1.0.5",
|
|
31
|
+
"@spinajs/validation": "^1.0.5",
|
|
32
|
+
"colors": "^1.4.0",
|
|
33
|
+
"glob": "^7.2.0",
|
|
34
|
+
"glob-to-regexp": "^0.4.1",
|
|
35
|
+
"lodash": "^4.17.14",
|
|
36
|
+
"luxon": "^2.3.0",
|
|
37
|
+
"node-schedule": "^2.1.0"
|
|
33
38
|
},
|
|
34
39
|
"devDependencies": {
|
|
35
40
|
"@types/bunyan": "^1.8.6",
|
|
36
41
|
"@types/chai": "^4.1.7",
|
|
37
42
|
"@types/chai-as-promised": "^7.1.0",
|
|
38
43
|
"@types/chai-subset": "^1.3.3",
|
|
44
|
+
"@types/colors": "^1.2.1",
|
|
45
|
+
"@types/glob": "^7.2.0",
|
|
46
|
+
"@types/glob-to-regexp": "^0.4.1",
|
|
39
47
|
"@types/lodash": "^4.14.136",
|
|
48
|
+
"@types/luxon": "^2.0.8",
|
|
40
49
|
"@types/mocha": "^5.2.7",
|
|
50
|
+
"@types/node": "^17.0.8",
|
|
51
|
+
"@types/node-schedule": "^1.3.2",
|
|
52
|
+
"@types/sinon": "^10.0.6",
|
|
41
53
|
"chai": "^4.2.0",
|
|
42
54
|
"chai-as-promised": "^7.1.1",
|
|
43
55
|
"chai-subset": "^1.6.0",
|
|
44
56
|
"mocha": "^6.1.4",
|
|
45
57
|
"nyc": "^14.1.1",
|
|
46
58
|
"prettier": "^1.18.2",
|
|
59
|
+
"sinon": "^12.0.1",
|
|
47
60
|
"ts-mocha": "^6.0.0",
|
|
48
61
|
"ts-node": "^8.3.0",
|
|
49
62
|
"tslint": "^5.20.1",
|
|
@@ -52,6 +65,6 @@
|
|
|
52
65
|
"tslint-config-standard": "^8.0.1",
|
|
53
66
|
"tslint-no-unused-expression-chai": "^0.1.4",
|
|
54
67
|
"typedoc": "^0.14.2",
|
|
55
|
-
"typescript": "^
|
|
68
|
+
"typescript": "^4.2.3"
|
|
56
69
|
}
|
|
57
70
|
}
|