@spinajs/log 1.1.8 → 1.2.9
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/.eslintignore +2 -0
- package/.eslintrc.js +43 -0
- package/lib/bootstrap.d.ts +4 -0
- package/lib/bootstrap.js +30 -0
- package/lib/bootstrap.js.map +1 -0
- package/lib/config/log.js +3 -3
- package/lib/config/log.js.map +1 -1
- package/lib/decorators.d.ts +3 -3
- package/lib/decorators.js +4 -4
- package/lib/decorators.js.map +1 -1
- package/lib/index.d.ts +7 -2
- package/lib/index.js +8 -2
- package/lib/index.js.map +1 -1
- package/lib/log.d.ts +8 -32
- package/lib/log.js +59 -123
- package/lib/log.js.map +1 -1
- package/lib/logger.d.ts +3 -7
- package/lib/logger.js +14 -24
- package/lib/logger.js.map +1 -1
- package/lib/schemas/log.configuration.d.ts +1 -0
- package/lib/schemas/log.configuration.js +91 -97
- package/lib/schemas/log.configuration.js.map +1 -1
- package/lib/targets/BlackHoleTarget.d.ts +3 -3
- package/lib/targets/BlackHoleTarget.js.map +1 -1
- package/lib/targets/ColoredConsoleTarget.d.ts +4 -5
- package/lib/targets/ColoredConsoleTarget.js +18 -14
- package/lib/targets/ColoredConsoleTarget.js.map +1 -1
- package/lib/targets/FileTarget.d.ts +3 -4
- package/lib/targets/FileTarget.js +84 -112
- package/lib/targets/FileTarget.js.map +1 -1
- package/lib/targets/LogTarget.d.ts +10 -5
- package/lib/targets/LogTarget.js +38 -36
- package/lib/targets/LogTarget.js.map +1 -1
- package/lib/targets/index.d.ts +1 -0
- package/lib/targets/index.js +1 -0
- package/lib/targets/index.js.map +1 -1
- package/lib/types.d.ts +13 -10
- package/lib/types.js +8 -8
- package/lib/types.js.map +1 -1
- package/lib/variables/date.d.ts +1 -1
- package/lib/variables/date.js +7 -7
- package/lib/variables/date.js.map +1 -1
- package/lib/variables/env.d.ts +1 -1
- package/lib/variables/env.js +4 -4
- package/lib/variables/env.js.map +1 -1
- package/lib/variables/process.d.ts +2 -3
- package/lib/variables/process.js +4 -16
- package/lib/variables/process.js.map +1 -1
- package/package.json +14 -39
- package/tsconfig.build.json +9 -0
package/lib/logger.js
CHANGED
|
@@ -5,36 +5,26 @@ 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 __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
13
|
-
const decorators_1 = require("@spinajs/configuration/lib/decorators");
|
|
9
|
+
exports.Logger = void 0;
|
|
14
10
|
const di_1 = require("@spinajs/di");
|
|
15
|
-
const validation_1 = require("@spinajs/validation");
|
|
16
11
|
const log_1 = require("./log");
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*/
|
|
22
|
-
this.Validator.validate("spinajs/log.configuration.schema.json", this.Options);
|
|
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__");
|
|
23
16
|
process.on("uncaughtException", (err) => {
|
|
24
|
-
log_1.Log
|
|
17
|
+
const log = di_1.DI.resolve(log_1.Log, ["process"]);
|
|
18
|
+
log.fatal(err, "Unhandled exception occured");
|
|
25
19
|
});
|
|
26
20
|
process.on("unhandledRejection", (reason, p) => {
|
|
27
|
-
log_1.Log
|
|
21
|
+
const log = di_1.DI.resolve(log_1.Log, ["process"]);
|
|
22
|
+
log.fatal(reason, "Unhandled rejection at Promise %s", p);
|
|
28
23
|
});
|
|
29
24
|
}
|
|
30
|
-
}
|
|
31
|
-
__decorate([
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
__decorate([
|
|
36
|
-
(0, decorators_1.Config)("logger"),
|
|
37
|
-
__metadata("design:type", Object)
|
|
38
|
-
], LogBootstrap.prototype, "Options", void 0);
|
|
39
|
-
exports.LogBootstrap = LogBootstrap;
|
|
25
|
+
};
|
|
26
|
+
Logger = __decorate([
|
|
27
|
+
di_1.Autoinject
|
|
28
|
+
], Logger);
|
|
29
|
+
exports.Logger = Logger;
|
|
40
30
|
//# sourceMappingURL=logger.js.map
|
package/lib/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -1,104 +1,102 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const CONFIGURATION_SCHEMA = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
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",
|
|
18
19
|
},
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
name: {
|
|
21
|
+
type: "string",
|
|
21
22
|
},
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
type: {
|
|
24
|
+
type: "string",
|
|
24
25
|
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
theme: {
|
|
27
|
+
type: "object",
|
|
28
|
+
properties: {
|
|
29
|
+
security: {
|
|
30
|
+
type: "string",
|
|
30
31
|
},
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
fatal: {
|
|
33
|
+
type: "string",
|
|
33
34
|
},
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
error: {
|
|
36
|
+
type: "string",
|
|
36
37
|
},
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
warn: {
|
|
39
|
+
type: "string",
|
|
39
40
|
},
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
success: {
|
|
42
|
+
type: "string",
|
|
42
43
|
},
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
info: {
|
|
45
|
+
type: "string",
|
|
45
46
|
},
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
debug: {
|
|
48
|
+
type: "string",
|
|
48
49
|
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
}
|
|
50
|
+
trace: {
|
|
51
|
+
type: "string",
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
enabled: {
|
|
56
|
+
type: "boolean",
|
|
53
57
|
},
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
path: {
|
|
59
|
+
type: "string",
|
|
56
60
|
},
|
|
57
|
-
|
|
58
|
-
|
|
61
|
+
archivePath: {
|
|
62
|
+
type: "string",
|
|
59
63
|
},
|
|
60
|
-
|
|
61
|
-
|
|
64
|
+
maxSize: {
|
|
65
|
+
type: "integer",
|
|
66
|
+
minimum: 10000,
|
|
62
67
|
},
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"minimum": 10000
|
|
68
|
+
compress: {
|
|
69
|
+
type: "boolean",
|
|
66
70
|
},
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
rotate: {
|
|
72
|
+
type: "string",
|
|
69
73
|
},
|
|
70
|
-
|
|
71
|
-
|
|
74
|
+
maxArchiveFiles: {
|
|
75
|
+
type: "integer",
|
|
76
|
+
minimum: 1,
|
|
72
77
|
},
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
bufferSize: {
|
|
79
|
+
type: "integer",
|
|
80
|
+
minimum: 1000,
|
|
76
81
|
},
|
|
77
|
-
"bufferSize": {
|
|
78
|
-
"type": "integer",
|
|
79
|
-
"minimum": 1000
|
|
80
|
-
}
|
|
81
82
|
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
"type"
|
|
85
|
-
]
|
|
86
|
-
}
|
|
83
|
+
required: ["name", "type"],
|
|
84
|
+
},
|
|
87
85
|
},
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
86
|
+
rules: {
|
|
87
|
+
description: "Log rules, what log should be write where",
|
|
88
|
+
type: "array",
|
|
89
|
+
minItems: 1,
|
|
90
|
+
uniqueItems: true,
|
|
91
|
+
items: {
|
|
92
|
+
type: "object",
|
|
93
|
+
properties: {
|
|
94
|
+
name: {
|
|
95
|
+
type: "string",
|
|
98
96
|
},
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
97
|
+
level: {
|
|
98
|
+
type: "string",
|
|
99
|
+
enum: [
|
|
102
100
|
"trace",
|
|
103
101
|
"debug",
|
|
104
102
|
"warn",
|
|
@@ -106,31 +104,27 @@ const CONFIGURATION_SCHEMA = {
|
|
|
106
104
|
"error",
|
|
107
105
|
"fatal",
|
|
108
106
|
"security",
|
|
109
|
-
"success"
|
|
110
|
-
]
|
|
107
|
+
"success",
|
|
108
|
+
],
|
|
111
109
|
},
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
target: {
|
|
111
|
+
oneOf: [
|
|
114
112
|
{
|
|
115
|
-
|
|
113
|
+
type: "string",
|
|
116
114
|
},
|
|
117
115
|
{
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
]
|
|
124
|
-
}
|
|
116
|
+
type: "array",
|
|
117
|
+
items: {
|
|
118
|
+
type: "string",
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
},
|
|
125
123
|
},
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
]
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
124
|
+
required: ["name", "level", "target"],
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
},
|
|
134
128
|
};
|
|
135
129
|
exports.default = CONFIGURATION_SCHEMA;
|
|
136
130
|
//# sourceMappingURL=log.configuration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.configuration.js","sourceRoot":"","sources":["../../src/schemas/log.configuration.ts"],"names":[],"mappings":";;AAAA,MAAM,oBAAoB,GAAG;
|
|
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,EAAE,wCAAwC;IACrD,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,OAAO,EAAE;YACP,WAAW,EACT,wEAAwE;YAC1E,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,CAAC;YACX,WAAW,EAAE,IAAI;YACjB,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,MAAM,EAAE;wBACN,IAAI,EAAE,QAAQ;qBACf;oBACD,IAAI,EAAE;wBACJ,IAAI,EAAE,QAAQ;qBACf;oBACD,IAAI,EAAE;wBACJ,IAAI,EAAE,QAAQ;qBACf;oBACD,KAAK,EAAE;wBACL,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE;4BACV,QAAQ,EAAE;gCACR,IAAI,EAAE,QAAQ;6BACf;4BACD,KAAK,EAAE;gCACL,IAAI,EAAE,QAAQ;6BACf;4BACD,KAAK,EAAE;gCACL,IAAI,EAAE,QAAQ;6BACf;4BACD,IAAI,EAAE;gCACJ,IAAI,EAAE,QAAQ;6BACf;4BACD,OAA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;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,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { LogTarget } from
|
|
1
|
+
import { ICommonTargetOptions } from "@spinajs/log-common";
|
|
2
|
+
import { LogTarget } from "./LogTarget";
|
|
3
3
|
/**
|
|
4
4
|
* Empty writer, usefull for tests or when we dont want to get any messages
|
|
5
5
|
*/
|
|
6
|
-
export declare class BlackHoleTarget extends LogTarget<
|
|
6
|
+
export declare class BlackHoleTarget extends LogTarget<ICommonTargetOptions> {
|
|
7
7
|
write(): Promise<void>;
|
|
8
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlackHoleTarget.js","sourceRoot":"","sources":["../../src/targets/BlackHoleTarget.ts"],"names":[],"mappings":";;;;;;;;;AACA,oCAAoD;AACpD,2CAAwC;AAExC;;GAEG;AAGH,IAAa,eAAe,GAA5B,MAAa,eAAgB,SAAQ,
|
|
1
|
+
{"version":3,"file":"BlackHoleTarget.js","sourceRoot":"","sources":["../../src/targets/BlackHoleTarget.ts"],"names":[],"mappings":";;;;;;;;;AACA,oCAAoD;AACpD,2CAAwC;AAExC;;GAEG;AAGH,IAAa,eAAe,GAA5B,MAAa,eAAgB,SAAQ,qBAA+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,6 +1,5 @@
|
|
|
1
|
-
import { IColoredConsoleTargetOptions,
|
|
2
|
-
import {
|
|
3
|
-
import { LogTarget } from './LogTarget';
|
|
1
|
+
import { IColoredConsoleTargetOptions, ILogEntry } from "@spinajs/log-common";
|
|
2
|
+
import { LogTarget } from "./LogTarget";
|
|
4
3
|
export declare const DEFAULT_THEME: {
|
|
5
4
|
security: string[];
|
|
6
5
|
fatal: string;
|
|
@@ -46,6 +45,6 @@ export declare class ColoredConsoleTarget extends LogTarget<IColoredConsoleTarge
|
|
|
46
45
|
(message?: any, ...optionalParams: any[]): void;
|
|
47
46
|
};
|
|
48
47
|
};
|
|
49
|
-
resolve(
|
|
50
|
-
write(data:
|
|
48
|
+
resolve(): void;
|
|
49
|
+
write(data: ILogEntry): Promise<void>;
|
|
51
50
|
}
|
|
@@ -7,21 +7,20 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.ColoredConsoleTarget = exports.DEFAULT_THEME = void 0;
|
|
10
|
-
const
|
|
10
|
+
const log_common_1 = require("@spinajs/log-common");
|
|
11
11
|
const di_1 = require("@spinajs/di");
|
|
12
12
|
const LogTarget_1 = require("./LogTarget");
|
|
13
13
|
const __1 = require("..");
|
|
14
|
-
|
|
15
|
-
const colors = require('colors/safe');
|
|
14
|
+
const colors = require("colors/safe");
|
|
16
15
|
exports.DEFAULT_THEME = {
|
|
17
|
-
security: [
|
|
18
|
-
fatal:
|
|
19
|
-
error:
|
|
20
|
-
warn:
|
|
21
|
-
success:
|
|
22
|
-
info:
|
|
23
|
-
debug:
|
|
24
|
-
trace:
|
|
16
|
+
security: ["red", "bgBrightWhite"],
|
|
17
|
+
fatal: "red",
|
|
18
|
+
error: "brightRed",
|
|
19
|
+
warn: "yellow",
|
|
20
|
+
success: "green",
|
|
21
|
+
info: "white",
|
|
22
|
+
debug: "gray",
|
|
23
|
+
trace: "gray",
|
|
25
24
|
};
|
|
26
25
|
let ColoredConsoleTarget = class ColoredConsoleTarget extends LogTarget_1.LogTarget {
|
|
27
26
|
constructor() {
|
|
@@ -37,16 +36,21 @@ let ColoredConsoleTarget = class ColoredConsoleTarget extends LogTarget_1.LogTar
|
|
|
37
36
|
[__1.LogLevel.Warn]: console.warn,
|
|
38
37
|
};
|
|
39
38
|
}
|
|
40
|
-
resolve(
|
|
39
|
+
resolve() {
|
|
41
40
|
var _a;
|
|
42
41
|
colors.setTheme((_a = this.Options.theme) !== null && _a !== void 0 ? _a : exports.DEFAULT_THEME);
|
|
43
|
-
super.resolve(
|
|
42
|
+
super.resolve();
|
|
44
43
|
}
|
|
45
44
|
async write(data) {
|
|
46
45
|
if (!this.Options.enabled) {
|
|
47
46
|
return;
|
|
48
47
|
}
|
|
49
|
-
this.StdConsoleCallbackMap[data.Level](
|
|
48
|
+
this.StdConsoleCallbackMap[data.Level](
|
|
49
|
+
/**
|
|
50
|
+
* we are safe to call, disable eslint
|
|
51
|
+
*/
|
|
52
|
+
/* eslint-disable */
|
|
53
|
+
colors[log_common_1.LogLevelStrings[data.Level]](this.format(data.Variables, this.Options.layout)));
|
|
50
54
|
}
|
|
51
55
|
};
|
|
52
56
|
ColoredConsoleTarget = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColoredConsoleTarget.js","sourceRoot":"","sources":["../../src/targets/ColoredConsoleTarget.ts"],"names":[],"mappings":";;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"ColoredConsoleTarget.js","sourceRoot":"","sources":["../../src/targets/ColoredConsoleTarget.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAI6B;AAC7B,oCAAoD;AACpD,2CAAwC;AACxC,0BAA8B;AAC9B,sCAAsC;AAEzB,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,EAA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,eAAe,CAAC;GACf,oBAAoB,CAmChC;AAnCY,oDAAoB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { IContainer } from "@spinajs/di";
|
|
2
1
|
import { LogTarget } from "./LogTarget";
|
|
3
|
-
import { IFileTargetOptions,
|
|
2
|
+
import { IFileTargetOptions, ILogEntry } from "@spinajs/log-common";
|
|
4
3
|
import { Job } from "node-schedule";
|
|
5
4
|
export declare class FileTarget extends LogTarget<IFileTargetOptions> {
|
|
6
5
|
protected LogDirPath: string;
|
|
@@ -15,8 +14,8 @@ export declare class FileTarget extends LogTarget<IFileTargetOptions> {
|
|
|
15
14
|
protected CurrentFileSize: number;
|
|
16
15
|
protected BufferSize: number;
|
|
17
16
|
protected Buffer: any[];
|
|
18
|
-
resolve(
|
|
19
|
-
write(data:
|
|
17
|
+
resolve(): void;
|
|
18
|
+
write(data: ILogEntry): Promise<void>;
|
|
20
19
|
protected archive(): void;
|
|
21
20
|
protected flush(): void;
|
|
22
21
|
private rotate;
|