@zthun/lumberjacky-log 3.0.0 → 3.0.2
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/dist/index.cjs +365 -135
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +362 -141
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/log-entry/log-entry.spec.d.ts +0 -1
- package/dist/logger/logger-composite.spec.d.ts +0 -1
- package/dist/logger/logger-console.spec.d.ts +0 -1
- package/dist/logger/logger-context.spec.d.ts +0 -1
- package/dist/logger/logger-silent.spec.d.ts +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,45 +1,131 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const lodashEs = require('lodash-es');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The log level.
|
|
9
|
+
*/ function _class_call_check$4(instance, Constructor) {
|
|
10
|
+
if (!(instance instanceof Constructor)) {
|
|
11
|
+
throw new TypeError("Cannot call a class as a function");
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function _defineProperties$3(target, props) {
|
|
15
|
+
for(var i = 0; i < props.length; i++){
|
|
16
|
+
var descriptor = props[i];
|
|
17
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
18
|
+
descriptor.configurable = true;
|
|
19
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
20
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function _create_class$3(Constructor, protoProps, staticProps) {
|
|
24
|
+
if (protoProps) _defineProperties$3(Constructor.prototype, protoProps);
|
|
25
|
+
return Constructor;
|
|
26
|
+
}
|
|
27
|
+
function _define_property$4(obj, key, value) {
|
|
28
|
+
if (key in obj) {
|
|
29
|
+
Object.defineProperty(obj, key, {
|
|
30
|
+
value: value,
|
|
31
|
+
enumerable: true,
|
|
32
|
+
configurable: true,
|
|
33
|
+
writable: true
|
|
34
|
+
});
|
|
35
|
+
} else {
|
|
36
|
+
obj[key] = value;
|
|
37
|
+
}
|
|
38
|
+
return obj;
|
|
39
|
+
}
|
|
40
|
+
function _object_spread(target) {
|
|
41
|
+
for(var i = 1; i < arguments.length; i++){
|
|
42
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
43
|
+
var ownKeys = Object.keys(source);
|
|
44
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
45
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
46
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
ownKeys.forEach(function(key) {
|
|
50
|
+
_define_property$4(target, key, source[key]);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return target;
|
|
54
|
+
}
|
|
55
|
+
var ZLogLevel = /*#__PURE__*/ function(ZLogLevel) {
|
|
56
|
+
/**
|
|
57
|
+
* A fatal error.
|
|
58
|
+
*
|
|
59
|
+
* Someone's pager is going off at 2:00 in the
|
|
60
|
+
* morning because the nuclear codes have gone off
|
|
61
|
+
* and missiles have been launched.
|
|
62
|
+
*/ ZLogLevel[ZLogLevel["CATASTROPHE"] = 0] = "CATASTROPHE";
|
|
63
|
+
/**
|
|
64
|
+
* A normal error that cause usually be recovered from.
|
|
65
|
+
*
|
|
66
|
+
* May require a fire being put out or some immediate
|
|
67
|
+
* response, but it is not world ending.
|
|
68
|
+
*/ ZLogLevel[ZLogLevel["ERROR"] = 1] = "ERROR";
|
|
69
|
+
/**
|
|
70
|
+
* Nothing is really wrong.
|
|
71
|
+
*
|
|
72
|
+
* Should probably not be ignored and
|
|
73
|
+
* action should be taken, but it's not
|
|
74
|
+
* serious enough to call the fire
|
|
75
|
+
* department.
|
|
76
|
+
*/ ZLogLevel[ZLogLevel["WARNING"] = 2] = "WARNING";
|
|
77
|
+
/**
|
|
78
|
+
* Some information that's good to know.
|
|
79
|
+
*
|
|
80
|
+
* Analytic logs are in this zone and general
|
|
81
|
+
* information goes in this zone. Debug as
|
|
82
|
+
* well, goes into this zone.
|
|
83
|
+
*
|
|
84
|
+
* It is normally best to avoid this log level
|
|
85
|
+
* unless it's really important to display.
|
|
86
|
+
*/ ZLogLevel[ZLogLevel["INFO"] = 3] = "INFO";
|
|
87
|
+
return ZLogLevel;
|
|
88
|
+
}({});
|
|
89
|
+
/**
|
|
90
|
+
* Represents a builder for a log entry
|
|
91
|
+
*/ var ZLogEntryBuilder = /*#__PURE__*/ function() {
|
|
92
|
+
function ZLogEntryBuilder() {
|
|
93
|
+
_class_call_check$4(this, ZLogEntryBuilder);
|
|
94
|
+
_define_property$4(this, "_entry", void 0);
|
|
95
|
+
/**
|
|
96
|
+
* Sets the log level to catastrophe.
|
|
97
|
+
*
|
|
98
|
+
* @returns
|
|
99
|
+
* This object.
|
|
100
|
+
*/ _define_property$4(this, "catastrophe", this.level.bind(this, 0));
|
|
101
|
+
/**
|
|
102
|
+
* Sets the log level to error.
|
|
103
|
+
*
|
|
104
|
+
* @returns
|
|
105
|
+
* This object.
|
|
106
|
+
*/ _define_property$4(this, "error", this.level.bind(this, 1));
|
|
107
|
+
/**
|
|
108
|
+
* Sets the log level to warning.
|
|
109
|
+
*
|
|
110
|
+
* @returns
|
|
111
|
+
* This object.
|
|
112
|
+
*/ _define_property$4(this, "warning", this.level.bind(this, 2));
|
|
113
|
+
/**
|
|
114
|
+
* Sets the log level to info.
|
|
115
|
+
*
|
|
116
|
+
* @returns
|
|
117
|
+
* This object.
|
|
118
|
+
*/ _define_property$4(this, "info", this.level.bind(this, 3));
|
|
119
|
+
this._entry = {
|
|
120
|
+
level: 1,
|
|
121
|
+
message: "",
|
|
122
|
+
created: new Date().toJSON()
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
_create_class$3(ZLogEntryBuilder, [
|
|
126
|
+
{
|
|
127
|
+
key: "level",
|
|
128
|
+
value: /**
|
|
43
129
|
* Sets the log level.
|
|
44
130
|
*
|
|
45
131
|
* @param level -
|
|
@@ -47,12 +133,14 @@ class ZLogEntryBuilder {
|
|
|
47
133
|
*
|
|
48
134
|
* @returns
|
|
49
135
|
* This object.
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
136
|
+
*/ function level(level) {
|
|
137
|
+
this._entry.level = level;
|
|
138
|
+
return this;
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
key: "context",
|
|
143
|
+
value: /**
|
|
56
144
|
* Sets the context of the entry.
|
|
57
145
|
*
|
|
58
146
|
* @param ctx -
|
|
@@ -60,12 +148,14 @@ class ZLogEntryBuilder {
|
|
|
60
148
|
*
|
|
61
149
|
* @returns
|
|
62
150
|
* This object.
|
|
63
|
-
*/
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
151
|
+
*/ function context(ctx) {
|
|
152
|
+
this._entry.context = ctx;
|
|
153
|
+
return this;
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
key: "message",
|
|
158
|
+
value: /**
|
|
69
159
|
* Sets the message.
|
|
70
160
|
*
|
|
71
161
|
* @param msg -
|
|
@@ -73,12 +163,14 @@ class ZLogEntryBuilder {
|
|
|
73
163
|
*
|
|
74
164
|
* @returns
|
|
75
165
|
* This object.
|
|
76
|
-
*/
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
166
|
+
*/ function message(msg) {
|
|
167
|
+
this._entry.message = msg;
|
|
168
|
+
return this;
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
key: "copy",
|
|
173
|
+
value: /**
|
|
82
174
|
* Copies the other entry into the current entry.
|
|
83
175
|
*
|
|
84
176
|
* @param other -
|
|
@@ -86,94 +178,232 @@ class ZLogEntryBuilder {
|
|
|
86
178
|
*
|
|
87
179
|
* @returns
|
|
88
180
|
* This object.
|
|
89
|
-
*/
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
181
|
+
*/ function copy(other) {
|
|
182
|
+
this._entry = structuredClone(other);
|
|
183
|
+
return this;
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
key: "build",
|
|
188
|
+
value: /**
|
|
95
189
|
* Returns a copy of the built log entry.
|
|
96
190
|
*
|
|
97
191
|
* @returns
|
|
98
192
|
* The built log entry.
|
|
99
|
-
*/
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
193
|
+
*/ function build() {
|
|
194
|
+
return _object_spread({}, this._entry);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
]);
|
|
198
|
+
return ZLogEntryBuilder;
|
|
199
|
+
}();
|
|
200
|
+
|
|
201
|
+
function _class_call_check$3(instance, Constructor) {
|
|
202
|
+
if (!(instance instanceof Constructor)) {
|
|
203
|
+
throw new TypeError("Cannot call a class as a function");
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function _defineProperties$2(target, props) {
|
|
207
|
+
for(var i = 0; i < props.length; i++){
|
|
208
|
+
var descriptor = props[i];
|
|
209
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
210
|
+
descriptor.configurable = true;
|
|
211
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
212
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
function _create_class$2(Constructor, protoProps, staticProps) {
|
|
216
|
+
if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
|
|
217
|
+
return Constructor;
|
|
218
|
+
}
|
|
219
|
+
function _define_property$3(obj, key, value) {
|
|
220
|
+
if (key in obj) {
|
|
221
|
+
Object.defineProperty(obj, key, {
|
|
222
|
+
value: value,
|
|
223
|
+
enumerable: true,
|
|
224
|
+
configurable: true,
|
|
225
|
+
writable: true
|
|
226
|
+
});
|
|
227
|
+
} else {
|
|
228
|
+
obj[key] = value;
|
|
229
|
+
}
|
|
230
|
+
return obj;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Represents a logger that logs to multiple sources.
|
|
234
|
+
*/ var ZLoggerComposite = /*#__PURE__*/ function() {
|
|
235
|
+
function ZLoggerComposite(_children) {
|
|
236
|
+
_class_call_check$3(this, ZLoggerComposite);
|
|
237
|
+
_define_property$3(this, "_children", void 0);
|
|
238
|
+
this._children = _children;
|
|
239
|
+
}
|
|
240
|
+
_create_class$2(ZLoggerComposite, [
|
|
241
|
+
{
|
|
242
|
+
key: "log",
|
|
243
|
+
value: /**
|
|
115
244
|
* Logs the entry into every one of the child loggers.
|
|
116
245
|
*
|
|
117
246
|
* @param entry -
|
|
118
247
|
* The entry to log.
|
|
119
|
-
*/
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
248
|
+
*/ function log(entry) {
|
|
249
|
+
this._children.forEach(function(logger) {
|
|
250
|
+
return logger.log(entry);
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
]);
|
|
255
|
+
return ZLoggerComposite;
|
|
256
|
+
}();
|
|
257
|
+
|
|
258
|
+
function _class_call_check$2(instance, Constructor) {
|
|
259
|
+
if (!(instance instanceof Constructor)) {
|
|
260
|
+
throw new TypeError("Cannot call a class as a function");
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
function _defineProperties$1(target, props) {
|
|
264
|
+
for(var i = 0; i < props.length; i++){
|
|
265
|
+
var descriptor = props[i];
|
|
266
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
267
|
+
descriptor.configurable = true;
|
|
268
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
269
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function _create_class$1(Constructor, protoProps, staticProps) {
|
|
273
|
+
if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
|
|
274
|
+
return Constructor;
|
|
275
|
+
}
|
|
276
|
+
function _define_property$2(obj, key, value) {
|
|
277
|
+
if (key in obj) {
|
|
278
|
+
Object.defineProperty(obj, key, {
|
|
279
|
+
value: value,
|
|
280
|
+
enumerable: true,
|
|
281
|
+
configurable: true,
|
|
282
|
+
writable: true
|
|
283
|
+
});
|
|
284
|
+
} else {
|
|
285
|
+
obj[key] = value;
|
|
286
|
+
}
|
|
287
|
+
return obj;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Represents a logger that logs to the console.
|
|
291
|
+
*/ var ZLoggerConsole = /*#__PURE__*/ function() {
|
|
292
|
+
function ZLoggerConsole(_console) {
|
|
293
|
+
_class_call_check$2(this, ZLoggerConsole);
|
|
294
|
+
_define_property$2(this, "_console", void 0);
|
|
295
|
+
_define_property$2(this, "_logFnMap", void 0);
|
|
296
|
+
this._console = _console;
|
|
297
|
+
var _obj;
|
|
298
|
+
this._logFnMap = (_obj = {}, _define_property$2(_obj, ZLogLevel.CATASTROPHE, function(msg) {
|
|
299
|
+
return _console.error(msg);
|
|
300
|
+
}), _define_property$2(_obj, ZLogLevel.ERROR, function(msg) {
|
|
301
|
+
return _console.error(msg);
|
|
302
|
+
}), _define_property$2(_obj, ZLogLevel.WARNING, function(msg) {
|
|
303
|
+
return _console.warn(msg);
|
|
304
|
+
}), _obj);
|
|
305
|
+
}
|
|
306
|
+
_create_class$1(ZLoggerConsole, [
|
|
307
|
+
{
|
|
308
|
+
key: "log",
|
|
309
|
+
value: /**
|
|
140
310
|
* Logs the entry to the console.
|
|
141
311
|
*
|
|
142
312
|
* @param entry -
|
|
143
313
|
* The entry to log.
|
|
144
|
-
*/
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
314
|
+
*/ function log(entry) {
|
|
315
|
+
var _this = this;
|
|
316
|
+
var fn = this._logFnMap[entry.level] || function(msg) {
|
|
317
|
+
return _this._console.log(msg);
|
|
318
|
+
};
|
|
319
|
+
var timestamp = "[".concat(entry.created.toLocaleString(), "]");
|
|
320
|
+
var payload = entry.level === ZLogLevel.CATASTROPHE ? ": ".concat(ZLoggerConsole.FATAL, " - ").concat(entry.message) : ": ".concat(entry.message);
|
|
321
|
+
fn("".concat(timestamp).concat(payload));
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
]);
|
|
325
|
+
return ZLoggerConsole;
|
|
326
|
+
}();
|
|
327
|
+
_define_property$2(ZLoggerConsole, "FATAL", "!!FATAL!!");
|
|
328
|
+
|
|
329
|
+
function _class_call_check$1(instance, Constructor) {
|
|
330
|
+
if (!(instance instanceof Constructor)) {
|
|
331
|
+
throw new TypeError("Cannot call a class as a function");
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
function _defineProperties(target, props) {
|
|
335
|
+
for(var i = 0; i < props.length; i++){
|
|
336
|
+
var descriptor = props[i];
|
|
337
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
338
|
+
descriptor.configurable = true;
|
|
339
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
340
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
344
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
345
|
+
return Constructor;
|
|
176
346
|
}
|
|
347
|
+
function _define_property$1(obj, key, value) {
|
|
348
|
+
if (key in obj) {
|
|
349
|
+
Object.defineProperty(obj, key, {
|
|
350
|
+
value: value,
|
|
351
|
+
enumerable: true,
|
|
352
|
+
configurable: true,
|
|
353
|
+
writable: true
|
|
354
|
+
});
|
|
355
|
+
} else {
|
|
356
|
+
obj[key] = value;
|
|
357
|
+
}
|
|
358
|
+
return obj;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* A logger that sets up a default context in the case that one is not given in the entry.
|
|
362
|
+
*/ var ZLoggerContext = /*#__PURE__*/ function() {
|
|
363
|
+
function ZLoggerContext(_context, _forward) {
|
|
364
|
+
_class_call_check$1(this, ZLoggerContext);
|
|
365
|
+
_define_property$1(this, "_context", void 0);
|
|
366
|
+
_define_property$1(this, "_forward", void 0);
|
|
367
|
+
this._context = _context;
|
|
368
|
+
this._forward = _forward;
|
|
369
|
+
}
|
|
370
|
+
_create_class(ZLoggerContext, [
|
|
371
|
+
{
|
|
372
|
+
key: "log",
|
|
373
|
+
value: function log(entry) {
|
|
374
|
+
var clone = new ZLogEntryBuilder().copy(entry).context(entry.context || this._context).build();
|
|
375
|
+
return this._forward.log(clone);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
]);
|
|
379
|
+
return ZLoggerContext;
|
|
380
|
+
}();
|
|
381
|
+
|
|
382
|
+
function _class_call_check(instance, Constructor) {
|
|
383
|
+
if (!(instance instanceof Constructor)) {
|
|
384
|
+
throw new TypeError("Cannot call a class as a function");
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
function _define_property(obj, key, value) {
|
|
388
|
+
if (key in obj) {
|
|
389
|
+
Object.defineProperty(obj, key, {
|
|
390
|
+
value: value,
|
|
391
|
+
enumerable: true,
|
|
392
|
+
configurable: true,
|
|
393
|
+
writable: true
|
|
394
|
+
});
|
|
395
|
+
} else {
|
|
396
|
+
obj[key] = value;
|
|
397
|
+
}
|
|
398
|
+
return obj;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* A silent logger. This logger does nothing.
|
|
402
|
+
*/ var ZLoggerSilent = function ZLoggerSilent() {
|
|
403
|
+
_class_call_check(this, ZLoggerSilent);
|
|
404
|
+
_define_property(this, "log", lodashEs.noop);
|
|
405
|
+
};
|
|
406
|
+
|
|
177
407
|
exports.ZLogEntryBuilder = ZLogEntryBuilder;
|
|
178
408
|
exports.ZLogLevel = ZLogLevel;
|
|
179
409
|
exports.ZLoggerComposite = ZLoggerComposite;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/log-entry/log-entry.mts","../src/logger/logger-composite.mts","../src/logger/logger-console.mts","../src/logger/logger-context.mts","../src/logger/logger-silent.mts"],"sourcesContent":["/**\n * The log level.\n */\nexport enum ZLogLevel {\n /**\n * A fatal error.\n *\n * Someone's pager is going off at 2:00 in the\n * morning because the nuclear codes have gone off\n * and missiles have been launched.\n */\n CATASTROPHE = 0,\n\n /**\n * A normal error that cause usually be recovered from.\n *\n * May require a fire being put out or some immediate\n * response, but it is not world ending.\n */\n ERROR = 1,\n\n /**\n * Nothing is really wrong.\n *\n * Should probably not be ignored and\n * action should be taken, but it's not\n * serious enough to call the fire\n * department.\n */\n WARNING = 2,\n\n /**\n * Some information that's good to know.\n *\n * Analytic logs are in this zone and general\n * information goes in this zone. Debug as\n * well, goes into this zone.\n *\n * It is normally best to avoid this log level\n * unless it's really important to display.\n */\n INFO = 3,\n}\n\n/**\n * Represents a log entry.\n */\nexport interface IZLogEntry {\n /**\n * The log context.\n *\n * This will usually be a friendly name of a function\n * or class where this log took place.\n */\n context?: string;\n\n /**\n * The log level.\n */\n level: ZLogLevel;\n\n /**\n * The creation of this entry.\n */\n created: Date | string;\n\n /**\n * The log message.\n */\n message: string;\n}\n\n/**\n * Represents a builder for a log entry\n */\nexport class ZLogEntryBuilder {\n private _entry: IZLogEntry;\n\n /**\n * Initializes a new instance of this object.\n */\n public constructor() {\n this._entry = {\n level: ZLogLevel.ERROR,\n message: \"\",\n created: new Date().toJSON(),\n };\n }\n\n /**\n * Sets the log level.\n *\n * @param level -\n * The log level.\n *\n * @returns\n * This object.\n */\n public level(level: ZLogLevel) {\n this._entry.level = level;\n return this;\n }\n\n /**\n * Sets the log level to catastrophe.\n *\n * @returns\n * This object.\n */\n public catastrophe = this.level.bind(this, ZLogLevel.CATASTROPHE);\n\n /**\n * Sets the log level to error.\n *\n * @returns\n * This object.\n */\n public error = this.level.bind(this, ZLogLevel.ERROR);\n\n /**\n * Sets the log level to warning.\n *\n * @returns\n * This object.\n */\n public warning = this.level.bind(this, ZLogLevel.WARNING);\n\n /**\n * Sets the log level to info.\n *\n * @returns\n * This object.\n */\n public info = this.level.bind(this, ZLogLevel.INFO);\n\n /**\n * Sets the context of the entry.\n *\n * @param ctx -\n * The entry context.\n *\n * @returns\n * This object.\n */\n public context(ctx: string | undefined): this {\n this._entry.context = ctx;\n return this;\n }\n\n /**\n * Sets the message.\n *\n * @param msg -\n * The message to log.\n *\n * @returns\n * This object.\n */\n public message(msg: string): this {\n this._entry.message = msg;\n return this;\n }\n\n /**\n * Copies the other entry into the current entry.\n *\n * @param other -\n * The entry to copy.\n *\n * @returns\n * This object.\n */\n public copy(other: IZLogEntry): this {\n this._entry = structuredClone(other);\n return this;\n }\n\n /**\n * Returns a copy of the built log entry.\n *\n * @returns\n * The built log entry.\n */\n public build(): IZLogEntry {\n return { ...this._entry };\n }\n}\n","import type { IZLogEntry } from \"../log-entry/log-entry.mjs\";\nimport type { IZLogger } from \"./logger.mjs\";\n\n/**\n * Represents a logger that logs to multiple sources.\n */\nexport class ZLoggerComposite implements IZLogger {\n /**\n * Initializes a new instance of this object.\n *\n * @param _children -\n * The collection of child loggers to log to.\n */\n public constructor(private readonly _children: IZLogger[]) {}\n\n /**\n * Logs the entry into every one of the child loggers.\n *\n * @param entry -\n * The entry to log.\n */\n public log(entry: IZLogEntry): void {\n this._children.forEach((logger) => logger.log(entry));\n }\n}\n","import type { IZLogEntry } from \"../log-entry/log-entry.mjs\";\nimport { ZLogLevel } from \"../log-entry/log-entry.mjs\";\nimport type { IZLogger } from \"./logger.mjs\";\n\n/**\n * Represents a logger that logs to the console.\n */\nexport class ZLoggerConsole implements IZLogger {\n public static readonly FATAL = \"!!FATAL!!\";\n private _logFnMap: any;\n\n /**\n * Initializes a new instance of this object.\n *\n * @param _console -\n * The console to log to.\n */\n public constructor(private _console: Console) {\n this._logFnMap = {\n [ZLogLevel.CATASTROPHE]: (msg: string) => _console.error(msg),\n [ZLogLevel.ERROR]: (msg: string) => _console.error(msg),\n [ZLogLevel.WARNING]: (msg: string) => _console.warn(msg),\n };\n }\n\n /**\n * Logs the entry to the console.\n *\n * @param entry -\n * The entry to log.\n */\n public log(entry: IZLogEntry): void {\n const fn =\n this._logFnMap[entry.level] || ((msg: string) => this._console.log(msg));\n\n const timestamp = `[${entry.created.toLocaleString()}]`;\n const payload =\n entry.level === ZLogLevel.CATASTROPHE\n ? `: ${ZLoggerConsole.FATAL} - ${entry.message}`\n : `: ${entry.message}`;\n fn(`${timestamp}${payload}`);\n }\n}\n","import type { IZLogEntry } from \"../log-entry/log-entry.mjs\";\nimport { ZLogEntryBuilder } from \"../log-entry/log-entry.mjs\";\nimport type { IZLogger } from \"./logger.mjs\";\n\n/**\n * A logger that sets up a default context in the case that one is not given in the entry.\n */\nexport class ZLoggerContext implements IZLogger {\n /**\n * Initializes a new instance of this object.\n *\n * @param _context -\n * The default context if one is not provided in the entry.\n * @param _forward -\n * The logger to forward to.\n */\n public constructor(\n private _context: string,\n private _forward: IZLogger,\n ) {}\n\n public log(entry: IZLogEntry): void {\n const clone = new ZLogEntryBuilder()\n .copy(entry)\n .context(entry.context || this._context)\n .build();\n return this._forward.log(clone);\n }\n}\n","import { noop } from \"lodash-es\";\nimport type { IZLogEntry } from \"../log-entry/log-entry.mjs\";\nimport type { IZLogger } from \"./logger.mjs\";\n\n/**\n * A silent logger. This logger does nothing.\n */\nexport class ZLoggerSilent implements IZLogger {\n public log: (_: IZLogEntry) => void = noop;\n}\n"],"names":["ZLogLevel","noop"],"mappings":";;;AAGY,IAAA,8BAAAA,eAAL;AAQLA,aAAAA,WAAA,iBAAc,CAAd,IAAA;AAQAA,aAAAA,WAAA,WAAQ,CAAR,IAAA;AAUAA,aAAAA,WAAA,aAAU,CAAV,IAAA;AAYAA,aAAAA,WAAA,UAAO,CAAP,IAAA;AAtCUA,SAAAA;AAAA,GAAA,aAAA,CAAA,CAAA;AAwEL,MAAM,i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AA,EAAxC,cAAA;AACL,SAAO,MAA+BC,SAAA;AAAA,EAAA;AACxC;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/log-entry/log-entry.mts","../src/logger/logger-composite.mts","../src/logger/logger-console.mts","../src/logger/logger-context.mts","../src/logger/logger-silent.mts"],"sourcesContent":["/**\n * The log level.\n */\nexport enum ZLogLevel {\n /**\n * A fatal error.\n *\n * Someone's pager is going off at 2:00 in the\n * morning because the nuclear codes have gone off\n * and missiles have been launched.\n */\n CATASTROPHE = 0,\n\n /**\n * A normal error that cause usually be recovered from.\n *\n * May require a fire being put out or some immediate\n * response, but it is not world ending.\n */\n ERROR = 1,\n\n /**\n * Nothing is really wrong.\n *\n * Should probably not be ignored and\n * action should be taken, but it's not\n * serious enough to call the fire\n * department.\n */\n WARNING = 2,\n\n /**\n * Some information that's good to know.\n *\n * Analytic logs are in this zone and general\n * information goes in this zone. Debug as\n * well, goes into this zone.\n *\n * It is normally best to avoid this log level\n * unless it's really important to display.\n */\n INFO = 3,\n}\n\n/**\n * Represents a log entry.\n */\nexport interface IZLogEntry {\n /**\n * The log context.\n *\n * This will usually be a friendly name of a function\n * or class where this log took place.\n */\n context?: string;\n\n /**\n * The log level.\n */\n level: ZLogLevel;\n\n /**\n * The creation of this entry.\n */\n created: Date | string;\n\n /**\n * The log message.\n */\n message: string;\n}\n\n/**\n * Represents a builder for a log entry\n */\nexport class ZLogEntryBuilder {\n private _entry: IZLogEntry;\n\n /**\n * Initializes a new instance of this object.\n */\n public constructor() {\n this._entry = {\n level: ZLogLevel.ERROR,\n message: \"\",\n created: new Date().toJSON(),\n };\n }\n\n /**\n * Sets the log level.\n *\n * @param level -\n * The log level.\n *\n * @returns\n * This object.\n */\n public level(level: ZLogLevel) {\n this._entry.level = level;\n return this;\n }\n\n /**\n * Sets the log level to catastrophe.\n *\n * @returns\n * This object.\n */\n public catastrophe = this.level.bind(this, ZLogLevel.CATASTROPHE);\n\n /**\n * Sets the log level to error.\n *\n * @returns\n * This object.\n */\n public error = this.level.bind(this, ZLogLevel.ERROR);\n\n /**\n * Sets the log level to warning.\n *\n * @returns\n * This object.\n */\n public warning = this.level.bind(this, ZLogLevel.WARNING);\n\n /**\n * Sets the log level to info.\n *\n * @returns\n * This object.\n */\n public info = this.level.bind(this, ZLogLevel.INFO);\n\n /**\n * Sets the context of the entry.\n *\n * @param ctx -\n * The entry context.\n *\n * @returns\n * This object.\n */\n public context(ctx: string | undefined): this {\n this._entry.context = ctx;\n return this;\n }\n\n /**\n * Sets the message.\n *\n * @param msg -\n * The message to log.\n *\n * @returns\n * This object.\n */\n public message(msg: string): this {\n this._entry.message = msg;\n return this;\n }\n\n /**\n * Copies the other entry into the current entry.\n *\n * @param other -\n * The entry to copy.\n *\n * @returns\n * This object.\n */\n public copy(other: IZLogEntry): this {\n this._entry = structuredClone(other);\n return this;\n }\n\n /**\n * Returns a copy of the built log entry.\n *\n * @returns\n * The built log entry.\n */\n public build(): IZLogEntry {\n return { ...this._entry };\n }\n}\n","import type { IZLogEntry } from \"../log-entry/log-entry.mjs\";\nimport type { IZLogger } from \"./logger.mjs\";\n\n/**\n * Represents a logger that logs to multiple sources.\n */\nexport class ZLoggerComposite implements IZLogger {\n /**\n * Initializes a new instance of this object.\n *\n * @param _children -\n * The collection of child loggers to log to.\n */\n public constructor(private readonly _children: IZLogger[]) {}\n\n /**\n * Logs the entry into every one of the child loggers.\n *\n * @param entry -\n * The entry to log.\n */\n public log(entry: IZLogEntry): void {\n this._children.forEach((logger) => logger.log(entry));\n }\n}\n","import type { IZLogEntry } from \"../log-entry/log-entry.mjs\";\nimport { ZLogLevel } from \"../log-entry/log-entry.mjs\";\nimport type { IZLogger } from \"./logger.mjs\";\n\n/**\n * Represents a logger that logs to the console.\n */\nexport class ZLoggerConsole implements IZLogger {\n public static readonly FATAL = \"!!FATAL!!\";\n private _logFnMap: any;\n\n /**\n * Initializes a new instance of this object.\n *\n * @param _console -\n * The console to log to.\n */\n public constructor(private _console: Console) {\n this._logFnMap = {\n [ZLogLevel.CATASTROPHE]: (msg: string) => _console.error(msg),\n [ZLogLevel.ERROR]: (msg: string) => _console.error(msg),\n [ZLogLevel.WARNING]: (msg: string) => _console.warn(msg),\n };\n }\n\n /**\n * Logs the entry to the console.\n *\n * @param entry -\n * The entry to log.\n */\n public log(entry: IZLogEntry): void {\n const fn =\n this._logFnMap[entry.level] || ((msg: string) => this._console.log(msg));\n\n const timestamp = `[${entry.created.toLocaleString()}]`;\n const payload =\n entry.level === ZLogLevel.CATASTROPHE\n ? `: ${ZLoggerConsole.FATAL} - ${entry.message}`\n : `: ${entry.message}`;\n fn(`${timestamp}${payload}`);\n }\n}\n","import type { IZLogEntry } from \"../log-entry/log-entry.mjs\";\nimport { ZLogEntryBuilder } from \"../log-entry/log-entry.mjs\";\nimport type { IZLogger } from \"./logger.mjs\";\n\n/**\n * A logger that sets up a default context in the case that one is not given in the entry.\n */\nexport class ZLoggerContext implements IZLogger {\n /**\n * Initializes a new instance of this object.\n *\n * @param _context -\n * The default context if one is not provided in the entry.\n * @param _forward -\n * The logger to forward to.\n */\n public constructor(\n private _context: string,\n private _forward: IZLogger,\n ) {}\n\n public log(entry: IZLogEntry): void {\n const clone = new ZLogEntryBuilder()\n .copy(entry)\n .context(entry.context || this._context)\n .build();\n return this._forward.log(clone);\n }\n}\n","import { noop } from \"lodash-es\";\nimport type { IZLogEntry } from \"../log-entry/log-entry.mjs\";\nimport type { IZLogger } from \"./logger.mjs\";\n\n/**\n * A silent logger. This logger does nothing.\n */\nexport class ZLoggerSilent implements IZLogger {\n public log: (_: IZLogEntry) => void = noop;\n}\n"],"names":["_class_call_check","ZLogLevel","ZLogEntryBuilder","_define_property","_entry","catastrophe","level","bind","error","warning","info","message","created","Date","toJSON","context","ctx","msg","copy","other","structuredClone","build","ZLoggerComposite","_children","log","entry","forEach","logger","ZLoggerConsole","_logFnMap","_console","CATASTROPHE","ERROR","WARNING","warn","fn","timestamp","toLocaleString","payload","FATAL","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,KAAA,EAAA,SAAOA,IAAIC,KAAiB,EAAA;AAC1B,gBAAA,IAAMkB,KAAQ,GAAA,IAAIzC,gBACfgB,EAAAA,CAAAA,IAAI,CAACO,KACLV,CAAAA,CAAAA,OAAO,CAACU,KAAAA,CAAMV,OAAO,IAAI,IAAI,CAAC2B,QAAQ,EACtCrB,KAAK,EAAA;AACR,gBAAA,OAAO,IAAI,CAACoB,QAAQ,CAACjB,GAAG,CAACmB,KAAAA,CAAAA;AAC3B;;;AApBWH,IAAAA,OAAAA,cAAAA;AAqBZ,CAAA;;;;;;;;;;;;;;;;;;;;ACxBD;;AAEC,IACM,IAAA,aAAMI,GAAN,SAAMA,aAAAA,GAAAA;AAAAA,IAAAA,iBAAAA,CAAAA,IAAAA,EAAAA,aAAAA,CAAAA;AACX,IAAA,gBAAA,CAAA,IAAA,EAAOpB,KAA+BqB,EAAAA,aAAAA,CAAAA;AACvC;;;;;;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -1,43 +1,127 @@
|
|
|
1
|
-
import { noop } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
1
|
+
import { noop } from 'lodash-es';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The log level.
|
|
5
|
+
*/ function _class_call_check$4(instance, Constructor) {
|
|
6
|
+
if (!(instance instanceof Constructor)) {
|
|
7
|
+
throw new TypeError("Cannot call a class as a function");
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function _defineProperties$3(target, props) {
|
|
11
|
+
for(var i = 0; i < props.length; i++){
|
|
12
|
+
var descriptor = props[i];
|
|
13
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
14
|
+
descriptor.configurable = true;
|
|
15
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
16
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function _create_class$3(Constructor, protoProps, staticProps) {
|
|
20
|
+
if (protoProps) _defineProperties$3(Constructor.prototype, protoProps);
|
|
21
|
+
return Constructor;
|
|
22
|
+
}
|
|
23
|
+
function _define_property$4(obj, key, value) {
|
|
24
|
+
if (key in obj) {
|
|
25
|
+
Object.defineProperty(obj, key, {
|
|
26
|
+
value: value,
|
|
27
|
+
enumerable: true,
|
|
28
|
+
configurable: true,
|
|
29
|
+
writable: true
|
|
30
|
+
});
|
|
31
|
+
} else {
|
|
32
|
+
obj[key] = value;
|
|
33
|
+
}
|
|
34
|
+
return obj;
|
|
35
|
+
}
|
|
36
|
+
function _object_spread(target) {
|
|
37
|
+
for(var i = 1; i < arguments.length; i++){
|
|
38
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
39
|
+
var ownKeys = Object.keys(source);
|
|
40
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
41
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
42
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
ownKeys.forEach(function(key) {
|
|
46
|
+
_define_property$4(target, key, source[key]);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return target;
|
|
50
|
+
}
|
|
51
|
+
var ZLogLevel = /*#__PURE__*/ function(ZLogLevel) {
|
|
52
|
+
/**
|
|
53
|
+
* A fatal error.
|
|
54
|
+
*
|
|
55
|
+
* Someone's pager is going off at 2:00 in the
|
|
56
|
+
* morning because the nuclear codes have gone off
|
|
57
|
+
* and missiles have been launched.
|
|
58
|
+
*/ ZLogLevel[ZLogLevel["CATASTROPHE"] = 0] = "CATASTROPHE";
|
|
59
|
+
/**
|
|
60
|
+
* A normal error that cause usually be recovered from.
|
|
61
|
+
*
|
|
62
|
+
* May require a fire being put out or some immediate
|
|
63
|
+
* response, but it is not world ending.
|
|
64
|
+
*/ ZLogLevel[ZLogLevel["ERROR"] = 1] = "ERROR";
|
|
65
|
+
/**
|
|
66
|
+
* Nothing is really wrong.
|
|
67
|
+
*
|
|
68
|
+
* Should probably not be ignored and
|
|
69
|
+
* action should be taken, but it's not
|
|
70
|
+
* serious enough to call the fire
|
|
71
|
+
* department.
|
|
72
|
+
*/ ZLogLevel[ZLogLevel["WARNING"] = 2] = "WARNING";
|
|
73
|
+
/**
|
|
74
|
+
* Some information that's good to know.
|
|
75
|
+
*
|
|
76
|
+
* Analytic logs are in this zone and general
|
|
77
|
+
* information goes in this zone. Debug as
|
|
78
|
+
* well, goes into this zone.
|
|
79
|
+
*
|
|
80
|
+
* It is normally best to avoid this log level
|
|
81
|
+
* unless it's really important to display.
|
|
82
|
+
*/ ZLogLevel[ZLogLevel["INFO"] = 3] = "INFO";
|
|
83
|
+
return ZLogLevel;
|
|
84
|
+
}({});
|
|
85
|
+
/**
|
|
86
|
+
* Represents a builder for a log entry
|
|
87
|
+
*/ var ZLogEntryBuilder = /*#__PURE__*/ function() {
|
|
88
|
+
function ZLogEntryBuilder() {
|
|
89
|
+
_class_call_check$4(this, ZLogEntryBuilder);
|
|
90
|
+
_define_property$4(this, "_entry", void 0);
|
|
91
|
+
/**
|
|
92
|
+
* Sets the log level to catastrophe.
|
|
93
|
+
*
|
|
94
|
+
* @returns
|
|
95
|
+
* This object.
|
|
96
|
+
*/ _define_property$4(this, "catastrophe", this.level.bind(this, 0));
|
|
97
|
+
/**
|
|
98
|
+
* Sets the log level to error.
|
|
99
|
+
*
|
|
100
|
+
* @returns
|
|
101
|
+
* This object.
|
|
102
|
+
*/ _define_property$4(this, "error", this.level.bind(this, 1));
|
|
103
|
+
/**
|
|
104
|
+
* Sets the log level to warning.
|
|
105
|
+
*
|
|
106
|
+
* @returns
|
|
107
|
+
* This object.
|
|
108
|
+
*/ _define_property$4(this, "warning", this.level.bind(this, 2));
|
|
109
|
+
/**
|
|
110
|
+
* Sets the log level to info.
|
|
111
|
+
*
|
|
112
|
+
* @returns
|
|
113
|
+
* This object.
|
|
114
|
+
*/ _define_property$4(this, "info", this.level.bind(this, 3));
|
|
115
|
+
this._entry = {
|
|
116
|
+
level: 1,
|
|
117
|
+
message: "",
|
|
118
|
+
created: new Date().toJSON()
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
_create_class$3(ZLogEntryBuilder, [
|
|
122
|
+
{
|
|
123
|
+
key: "level",
|
|
124
|
+
value: /**
|
|
41
125
|
* Sets the log level.
|
|
42
126
|
*
|
|
43
127
|
* @param level -
|
|
@@ -45,12 +129,14 @@ class ZLogEntryBuilder {
|
|
|
45
129
|
*
|
|
46
130
|
* @returns
|
|
47
131
|
* This object.
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
132
|
+
*/ function level(level) {
|
|
133
|
+
this._entry.level = level;
|
|
134
|
+
return this;
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
key: "context",
|
|
139
|
+
value: /**
|
|
54
140
|
* Sets the context of the entry.
|
|
55
141
|
*
|
|
56
142
|
* @param ctx -
|
|
@@ -58,12 +144,14 @@ class ZLogEntryBuilder {
|
|
|
58
144
|
*
|
|
59
145
|
* @returns
|
|
60
146
|
* This object.
|
|
61
|
-
*/
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
147
|
+
*/ function context(ctx) {
|
|
148
|
+
this._entry.context = ctx;
|
|
149
|
+
return this;
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
key: "message",
|
|
154
|
+
value: /**
|
|
67
155
|
* Sets the message.
|
|
68
156
|
*
|
|
69
157
|
* @param msg -
|
|
@@ -71,12 +159,14 @@ class ZLogEntryBuilder {
|
|
|
71
159
|
*
|
|
72
160
|
* @returns
|
|
73
161
|
* This object.
|
|
74
|
-
*/
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
162
|
+
*/ function message(msg) {
|
|
163
|
+
this._entry.message = msg;
|
|
164
|
+
return this;
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
key: "copy",
|
|
169
|
+
value: /**
|
|
80
170
|
* Copies the other entry into the current entry.
|
|
81
171
|
*
|
|
82
172
|
* @param other -
|
|
@@ -84,100 +174,231 @@ class ZLogEntryBuilder {
|
|
|
84
174
|
*
|
|
85
175
|
* @returns
|
|
86
176
|
* This object.
|
|
87
|
-
*/
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
177
|
+
*/ function copy(other) {
|
|
178
|
+
this._entry = structuredClone(other);
|
|
179
|
+
return this;
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
key: "build",
|
|
184
|
+
value: /**
|
|
93
185
|
* Returns a copy of the built log entry.
|
|
94
186
|
*
|
|
95
187
|
* @returns
|
|
96
188
|
* The built log entry.
|
|
97
|
-
*/
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
189
|
+
*/ function build() {
|
|
190
|
+
return _object_spread({}, this._entry);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
]);
|
|
194
|
+
return ZLogEntryBuilder;
|
|
195
|
+
}();
|
|
196
|
+
|
|
197
|
+
function _class_call_check$3(instance, Constructor) {
|
|
198
|
+
if (!(instance instanceof Constructor)) {
|
|
199
|
+
throw new TypeError("Cannot call a class as a function");
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function _defineProperties$2(target, props) {
|
|
203
|
+
for(var i = 0; i < props.length; i++){
|
|
204
|
+
var descriptor = props[i];
|
|
205
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
206
|
+
descriptor.configurable = true;
|
|
207
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
208
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
function _create_class$2(Constructor, protoProps, staticProps) {
|
|
212
|
+
if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
|
|
213
|
+
return Constructor;
|
|
214
|
+
}
|
|
215
|
+
function _define_property$3(obj, key, value) {
|
|
216
|
+
if (key in obj) {
|
|
217
|
+
Object.defineProperty(obj, key, {
|
|
218
|
+
value: value,
|
|
219
|
+
enumerable: true,
|
|
220
|
+
configurable: true,
|
|
221
|
+
writable: true
|
|
222
|
+
});
|
|
223
|
+
} else {
|
|
224
|
+
obj[key] = value;
|
|
225
|
+
}
|
|
226
|
+
return obj;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Represents a logger that logs to multiple sources.
|
|
230
|
+
*/ var ZLoggerComposite = /*#__PURE__*/ function() {
|
|
231
|
+
function ZLoggerComposite(_children) {
|
|
232
|
+
_class_call_check$3(this, ZLoggerComposite);
|
|
233
|
+
_define_property$3(this, "_children", void 0);
|
|
234
|
+
this._children = _children;
|
|
235
|
+
}
|
|
236
|
+
_create_class$2(ZLoggerComposite, [
|
|
237
|
+
{
|
|
238
|
+
key: "log",
|
|
239
|
+
value: /**
|
|
113
240
|
* Logs the entry into every one of the child loggers.
|
|
114
241
|
*
|
|
115
242
|
* @param entry -
|
|
116
243
|
* The entry to log.
|
|
117
|
-
*/
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
244
|
+
*/ function log(entry) {
|
|
245
|
+
this._children.forEach(function(logger) {
|
|
246
|
+
return logger.log(entry);
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
]);
|
|
251
|
+
return ZLoggerComposite;
|
|
252
|
+
}();
|
|
253
|
+
|
|
254
|
+
function _class_call_check$2(instance, Constructor) {
|
|
255
|
+
if (!(instance instanceof Constructor)) {
|
|
256
|
+
throw new TypeError("Cannot call a class as a function");
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
function _defineProperties$1(target, props) {
|
|
260
|
+
for(var i = 0; i < props.length; i++){
|
|
261
|
+
var descriptor = props[i];
|
|
262
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
263
|
+
descriptor.configurable = true;
|
|
264
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
265
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
function _create_class$1(Constructor, protoProps, staticProps) {
|
|
269
|
+
if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
|
|
270
|
+
return Constructor;
|
|
271
|
+
}
|
|
272
|
+
function _define_property$2(obj, key, value) {
|
|
273
|
+
if (key in obj) {
|
|
274
|
+
Object.defineProperty(obj, key, {
|
|
275
|
+
value: value,
|
|
276
|
+
enumerable: true,
|
|
277
|
+
configurable: true,
|
|
278
|
+
writable: true
|
|
279
|
+
});
|
|
280
|
+
} else {
|
|
281
|
+
obj[key] = value;
|
|
282
|
+
}
|
|
283
|
+
return obj;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Represents a logger that logs to the console.
|
|
287
|
+
*/ var ZLoggerConsole = /*#__PURE__*/ function() {
|
|
288
|
+
function ZLoggerConsole(_console) {
|
|
289
|
+
_class_call_check$2(this, ZLoggerConsole);
|
|
290
|
+
_define_property$2(this, "_console", void 0);
|
|
291
|
+
_define_property$2(this, "_logFnMap", void 0);
|
|
292
|
+
this._console = _console;
|
|
293
|
+
var _obj;
|
|
294
|
+
this._logFnMap = (_obj = {}, _define_property$2(_obj, ZLogLevel.CATASTROPHE, function(msg) {
|
|
295
|
+
return _console.error(msg);
|
|
296
|
+
}), _define_property$2(_obj, ZLogLevel.ERROR, function(msg) {
|
|
297
|
+
return _console.error(msg);
|
|
298
|
+
}), _define_property$2(_obj, ZLogLevel.WARNING, function(msg) {
|
|
299
|
+
return _console.warn(msg);
|
|
300
|
+
}), _obj);
|
|
301
|
+
}
|
|
302
|
+
_create_class$1(ZLoggerConsole, [
|
|
303
|
+
{
|
|
304
|
+
key: "log",
|
|
305
|
+
value: /**
|
|
138
306
|
* Logs the entry to the console.
|
|
139
307
|
*
|
|
140
308
|
* @param entry -
|
|
141
309
|
* The entry to log.
|
|
142
|
-
*/
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
310
|
+
*/ function log(entry) {
|
|
311
|
+
var _this = this;
|
|
312
|
+
var fn = this._logFnMap[entry.level] || function(msg) {
|
|
313
|
+
return _this._console.log(msg);
|
|
314
|
+
};
|
|
315
|
+
var timestamp = "[".concat(entry.created.toLocaleString(), "]");
|
|
316
|
+
var payload = entry.level === ZLogLevel.CATASTROPHE ? ": ".concat(ZLoggerConsole.FATAL, " - ").concat(entry.message) : ": ".concat(entry.message);
|
|
317
|
+
fn("".concat(timestamp).concat(payload));
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
]);
|
|
321
|
+
return ZLoggerConsole;
|
|
322
|
+
}();
|
|
323
|
+
_define_property$2(ZLoggerConsole, "FATAL", "!!FATAL!!");
|
|
324
|
+
|
|
325
|
+
function _class_call_check$1(instance, Constructor) {
|
|
326
|
+
if (!(instance instanceof Constructor)) {
|
|
327
|
+
throw new TypeError("Cannot call a class as a function");
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
function _defineProperties(target, props) {
|
|
331
|
+
for(var i = 0; i < props.length; i++){
|
|
332
|
+
var descriptor = props[i];
|
|
333
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
334
|
+
descriptor.configurable = true;
|
|
335
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
336
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
340
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
341
|
+
return Constructor;
|
|
342
|
+
}
|
|
343
|
+
function _define_property$1(obj, key, value) {
|
|
344
|
+
if (key in obj) {
|
|
345
|
+
Object.defineProperty(obj, key, {
|
|
346
|
+
value: value,
|
|
347
|
+
enumerable: true,
|
|
348
|
+
configurable: true,
|
|
349
|
+
writable: true
|
|
350
|
+
});
|
|
351
|
+
} else {
|
|
352
|
+
obj[key] = value;
|
|
353
|
+
}
|
|
354
|
+
return obj;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* A logger that sets up a default context in the case that one is not given in the entry.
|
|
358
|
+
*/ var ZLoggerContext = /*#__PURE__*/ function() {
|
|
359
|
+
function ZLoggerContext(_context, _forward) {
|
|
360
|
+
_class_call_check$1(this, ZLoggerContext);
|
|
361
|
+
_define_property$1(this, "_context", void 0);
|
|
362
|
+
_define_property$1(this, "_forward", void 0);
|
|
363
|
+
this._context = _context;
|
|
364
|
+
this._forward = _forward;
|
|
365
|
+
}
|
|
366
|
+
_create_class(ZLoggerContext, [
|
|
367
|
+
{
|
|
368
|
+
key: "log",
|
|
369
|
+
value: function log(entry) {
|
|
370
|
+
var clone = new ZLogEntryBuilder().copy(entry).context(entry.context || this._context).build();
|
|
371
|
+
return this._forward.log(clone);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
]);
|
|
375
|
+
return ZLoggerContext;
|
|
376
|
+
}();
|
|
377
|
+
|
|
378
|
+
function _class_call_check(instance, Constructor) {
|
|
379
|
+
if (!(instance instanceof Constructor)) {
|
|
380
|
+
throw new TypeError("Cannot call a class as a function");
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
function _define_property(obj, key, value) {
|
|
384
|
+
if (key in obj) {
|
|
385
|
+
Object.defineProperty(obj, key, {
|
|
386
|
+
value: value,
|
|
387
|
+
enumerable: true,
|
|
388
|
+
configurable: true,
|
|
389
|
+
writable: true
|
|
390
|
+
});
|
|
391
|
+
} else {
|
|
392
|
+
obj[key] = value;
|
|
393
|
+
}
|
|
394
|
+
return obj;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* A silent logger. This logger does nothing.
|
|
398
|
+
*/ var ZLoggerSilent = function ZLoggerSilent() {
|
|
399
|
+
_class_call_check(this, ZLoggerSilent);
|
|
400
|
+
_define_property(this, "log", noop);
|
|
182
401
|
};
|
|
402
|
+
|
|
403
|
+
export { ZLogEntryBuilder, ZLogLevel, ZLoggerComposite, ZLoggerConsole, ZLoggerContext, ZLoggerSilent };
|
|
183
404
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/log-entry/log-entry.mts","../src/logger/logger-composite.mts","../src/logger/logger-console.mts","../src/logger/logger-context.mts","../src/logger/logger-silent.mts"],"sourcesContent":["/**\n * The log level.\n */\nexport enum ZLogLevel {\n /**\n * A fatal error.\n *\n * Someone's pager is going off at 2:00 in the\n * morning because the nuclear codes have gone off\n * and missiles have been launched.\n */\n CATASTROPHE = 0,\n\n /**\n * A normal error that cause usually be recovered from.\n *\n * May require a fire being put out or some immediate\n * response, but it is not world ending.\n */\n ERROR = 1,\n\n /**\n * Nothing is really wrong.\n *\n * Should probably not be ignored and\n * action should be taken, but it's not\n * serious enough to call the fire\n * department.\n */\n WARNING = 2,\n\n /**\n * Some information that's good to know.\n *\n * Analytic logs are in this zone and general\n * information goes in this zone. Debug as\n * well, goes into this zone.\n *\n * It is normally best to avoid this log level\n * unless it's really important to display.\n */\n INFO = 3,\n}\n\n/**\n * Represents a log entry.\n */\nexport interface IZLogEntry {\n /**\n * The log context.\n *\n * This will usually be a friendly name of a function\n * or class where this log took place.\n */\n context?: string;\n\n /**\n * The log level.\n */\n level: ZLogLevel;\n\n /**\n * The creation of this entry.\n */\n created: Date | string;\n\n /**\n * The log message.\n */\n message: string;\n}\n\n/**\n * Represents a builder for a log entry\n */\nexport class ZLogEntryBuilder {\n private _entry: IZLogEntry;\n\n /**\n * Initializes a new instance of this object.\n */\n public constructor() {\n this._entry = {\n level: ZLogLevel.ERROR,\n message: \"\",\n created: new Date().toJSON(),\n };\n }\n\n /**\n * Sets the log level.\n *\n * @param level -\n * The log level.\n *\n * @returns\n * This object.\n */\n public level(level: ZLogLevel) {\n this._entry.level = level;\n return this;\n }\n\n /**\n * Sets the log level to catastrophe.\n *\n * @returns\n * This object.\n */\n public catastrophe = this.level.bind(this, ZLogLevel.CATASTROPHE);\n\n /**\n * Sets the log level to error.\n *\n * @returns\n * This object.\n */\n public error = this.level.bind(this, ZLogLevel.ERROR);\n\n /**\n * Sets the log level to warning.\n *\n * @returns\n * This object.\n */\n public warning = this.level.bind(this, ZLogLevel.WARNING);\n\n /**\n * Sets the log level to info.\n *\n * @returns\n * This object.\n */\n public info = this.level.bind(this, ZLogLevel.INFO);\n\n /**\n * Sets the context of the entry.\n *\n * @param ctx -\n * The entry context.\n *\n * @returns\n * This object.\n */\n public context(ctx: string | undefined): this {\n this._entry.context = ctx;\n return this;\n }\n\n /**\n * Sets the message.\n *\n * @param msg -\n * The message to log.\n *\n * @returns\n * This object.\n */\n public message(msg: string): this {\n this._entry.message = msg;\n return this;\n }\n\n /**\n * Copies the other entry into the current entry.\n *\n * @param other -\n * The entry to copy.\n *\n * @returns\n * This object.\n */\n public copy(other: IZLogEntry): this {\n this._entry = structuredClone(other);\n return this;\n }\n\n /**\n * Returns a copy of the built log entry.\n *\n * @returns\n * The built log entry.\n */\n public build(): IZLogEntry {\n return { ...this._entry };\n }\n}\n","import type { IZLogEntry } from \"../log-entry/log-entry.mjs\";\nimport type { IZLogger } from \"./logger.mjs\";\n\n/**\n * Represents a logger that logs to multiple sources.\n */\nexport class ZLoggerComposite implements IZLogger {\n /**\n * Initializes a new instance of this object.\n *\n * @param _children -\n * The collection of child loggers to log to.\n */\n public constructor(private readonly _children: IZLogger[]) {}\n\n /**\n * Logs the entry into every one of the child loggers.\n *\n * @param entry -\n * The entry to log.\n */\n public log(entry: IZLogEntry): void {\n this._children.forEach((logger) => logger.log(entry));\n }\n}\n","import type { IZLogEntry } from \"../log-entry/log-entry.mjs\";\nimport { ZLogLevel } from \"../log-entry/log-entry.mjs\";\nimport type { IZLogger } from \"./logger.mjs\";\n\n/**\n * Represents a logger that logs to the console.\n */\nexport class ZLoggerConsole implements IZLogger {\n public static readonly FATAL = \"!!FATAL!!\";\n private _logFnMap: any;\n\n /**\n * Initializes a new instance of this object.\n *\n * @param _console -\n * The console to log to.\n */\n public constructor(private _console: Console) {\n this._logFnMap = {\n [ZLogLevel.CATASTROPHE]: (msg: string) => _console.error(msg),\n [ZLogLevel.ERROR]: (msg: string) => _console.error(msg),\n [ZLogLevel.WARNING]: (msg: string) => _console.warn(msg),\n };\n }\n\n /**\n * Logs the entry to the console.\n *\n * @param entry -\n * The entry to log.\n */\n public log(entry: IZLogEntry): void {\n const fn =\n this._logFnMap[entry.level] || ((msg: string) => this._console.log(msg));\n\n const timestamp = `[${entry.created.toLocaleString()}]`;\n const payload =\n entry.level === ZLogLevel.CATASTROPHE\n ? `: ${ZLoggerConsole.FATAL} - ${entry.message}`\n : `: ${entry.message}`;\n fn(`${timestamp}${payload}`);\n }\n}\n","import type { IZLogEntry } from \"../log-entry/log-entry.mjs\";\nimport { ZLogEntryBuilder } from \"../log-entry/log-entry.mjs\";\nimport type { IZLogger } from \"./logger.mjs\";\n\n/**\n * A logger that sets up a default context in the case that one is not given in the entry.\n */\nexport class ZLoggerContext implements IZLogger {\n /**\n * Initializes a new instance of this object.\n *\n * @param _context -\n * The default context if one is not provided in the entry.\n * @param _forward -\n * The logger to forward to.\n */\n public constructor(\n private _context: string,\n private _forward: IZLogger,\n ) {}\n\n public log(entry: IZLogEntry): void {\n const clone = new ZLogEntryBuilder()\n .copy(entry)\n .context(entry.context || this._context)\n .build();\n return this._forward.log(clone);\n }\n}\n","import { noop } from \"lodash-es\";\nimport type { IZLogEntry } from \"../log-entry/log-entry.mjs\";\nimport type { IZLogger } from \"./logger.mjs\";\n\n/**\n * A silent logger. This logger does nothing.\n */\nexport class ZLoggerSilent implements IZLogger {\n public log: (_: IZLogEntry) => void = noop;\n}\n"],"names":["ZLogLevel"],"mappings":";AAGY,IAAA,8BAAAA,eAAL;AAQLA,aAAAA,WAAA,iBAAc,CAAd,IAAA;AAQAA,aAAAA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,UAAM,QAAQ,IAAI,mBACf,KAAK,KAAK,EACV,QAAQ,MAAM,WAAW,KAAK,QAAQ,EACtC,MAAM;AACF,WAAA,KAAK,SAAS,IAAI,KAAK;AAAA,EAAA;AAElC;ACrBO,MAAM,cAAkC;AAAA,EAAxC,cAAA;AACL,SAAO,MAA+B;AAAA,EAAA;AACxC;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/log-entry/log-entry.mts","../src/logger/logger-composite.mts","../src/logger/logger-console.mts","../src/logger/logger-context.mts","../src/logger/logger-silent.mts"],"sourcesContent":["/**\n * The log level.\n */\nexport enum ZLogLevel {\n /**\n * A fatal error.\n *\n * Someone's pager is going off at 2:00 in the\n * morning because the nuclear codes have gone off\n * and missiles have been launched.\n */\n CATASTROPHE = 0,\n\n /**\n * A normal error that cause usually be recovered from.\n *\n * May require a fire being put out or some immediate\n * response, but it is not world ending.\n */\n ERROR = 1,\n\n /**\n * Nothing is really wrong.\n *\n * Should probably not be ignored and\n * action should be taken, but it's not\n * serious enough to call the fire\n * department.\n */\n WARNING = 2,\n\n /**\n * Some information that's good to know.\n *\n * Analytic logs are in this zone and general\n * information goes in this zone. Debug as\n * well, goes into this zone.\n *\n * It is normally best to avoid this log level\n * unless it's really important to display.\n */\n INFO = 3,\n}\n\n/**\n * Represents a log entry.\n */\nexport interface IZLogEntry {\n /**\n * The log context.\n *\n * This will usually be a friendly name of a function\n * or class where this log took place.\n */\n context?: string;\n\n /**\n * The log level.\n */\n level: ZLogLevel;\n\n /**\n * The creation of this entry.\n */\n created: Date | string;\n\n /**\n * The log message.\n */\n message: string;\n}\n\n/**\n * Represents a builder for a log entry\n */\nexport class ZLogEntryBuilder {\n private _entry: IZLogEntry;\n\n /**\n * Initializes a new instance of this object.\n */\n public constructor() {\n this._entry = {\n level: ZLogLevel.ERROR,\n message: \"\",\n created: new Date().toJSON(),\n };\n }\n\n /**\n * Sets the log level.\n *\n * @param level -\n * The log level.\n *\n * @returns\n * This object.\n */\n public level(level: ZLogLevel) {\n this._entry.level = level;\n return this;\n }\n\n /**\n * Sets the log level to catastrophe.\n *\n * @returns\n * This object.\n */\n public catastrophe = this.level.bind(this, ZLogLevel.CATASTROPHE);\n\n /**\n * Sets the log level to error.\n *\n * @returns\n * This object.\n */\n public error = this.level.bind(this, ZLogLevel.ERROR);\n\n /**\n * Sets the log level to warning.\n *\n * @returns\n * This object.\n */\n public warning = this.level.bind(this, ZLogLevel.WARNING);\n\n /**\n * Sets the log level to info.\n *\n * @returns\n * This object.\n */\n public info = this.level.bind(this, ZLogLevel.INFO);\n\n /**\n * Sets the context of the entry.\n *\n * @param ctx -\n * The entry context.\n *\n * @returns\n * This object.\n */\n public context(ctx: string | undefined): this {\n this._entry.context = ctx;\n return this;\n }\n\n /**\n * Sets the message.\n *\n * @param msg -\n * The message to log.\n *\n * @returns\n * This object.\n */\n public message(msg: string): this {\n this._entry.message = msg;\n return this;\n }\n\n /**\n * Copies the other entry into the current entry.\n *\n * @param other -\n * The entry to copy.\n *\n * @returns\n * This object.\n */\n public copy(other: IZLogEntry): this {\n this._entry = structuredClone(other);\n return this;\n }\n\n /**\n * Returns a copy of the built log entry.\n *\n * @returns\n * The built log entry.\n */\n public build(): IZLogEntry {\n return { ...this._entry };\n }\n}\n","import type { IZLogEntry } from \"../log-entry/log-entry.mjs\";\nimport type { IZLogger } from \"./logger.mjs\";\n\n/**\n * Represents a logger that logs to multiple sources.\n */\nexport class ZLoggerComposite implements IZLogger {\n /**\n * Initializes a new instance of this object.\n *\n * @param _children -\n * The collection of child loggers to log to.\n */\n public constructor(private readonly _children: IZLogger[]) {}\n\n /**\n * Logs the entry into every one of the child loggers.\n *\n * @param entry -\n * The entry to log.\n */\n public log(entry: IZLogEntry): void {\n this._children.forEach((logger) => logger.log(entry));\n }\n}\n","import type { IZLogEntry } from \"../log-entry/log-entry.mjs\";\nimport { ZLogLevel } from \"../log-entry/log-entry.mjs\";\nimport type { IZLogger } from \"./logger.mjs\";\n\n/**\n * Represents a logger that logs to the console.\n */\nexport class ZLoggerConsole implements IZLogger {\n public static readonly FATAL = \"!!FATAL!!\";\n private _logFnMap: any;\n\n /**\n * Initializes a new instance of this object.\n *\n * @param _console -\n * The console to log to.\n */\n public constructor(private _console: Console) {\n this._logFnMap = {\n [ZLogLevel.CATASTROPHE]: (msg: string) => _console.error(msg),\n [ZLogLevel.ERROR]: (msg: string) => _console.error(msg),\n [ZLogLevel.WARNING]: (msg: string) => _console.warn(msg),\n };\n }\n\n /**\n * Logs the entry to the console.\n *\n * @param entry -\n * The entry to log.\n */\n public log(entry: IZLogEntry): void {\n const fn =\n this._logFnMap[entry.level] || ((msg: string) => this._console.log(msg));\n\n const timestamp = `[${entry.created.toLocaleString()}]`;\n const payload =\n entry.level === ZLogLevel.CATASTROPHE\n ? `: ${ZLoggerConsole.FATAL} - ${entry.message}`\n : `: ${entry.message}`;\n fn(`${timestamp}${payload}`);\n }\n}\n","import type { IZLogEntry } from \"../log-entry/log-entry.mjs\";\nimport { ZLogEntryBuilder } from \"../log-entry/log-entry.mjs\";\nimport type { IZLogger } from \"./logger.mjs\";\n\n/**\n * A logger that sets up a default context in the case that one is not given in the entry.\n */\nexport class ZLoggerContext implements IZLogger {\n /**\n * Initializes a new instance of this object.\n *\n * @param _context -\n * The default context if one is not provided in the entry.\n * @param _forward -\n * The logger to forward to.\n */\n public constructor(\n private _context: string,\n private _forward: IZLogger,\n ) {}\n\n public log(entry: IZLogEntry): void {\n const clone = new ZLogEntryBuilder()\n .copy(entry)\n .context(entry.context || this._context)\n .build();\n return this._forward.log(clone);\n }\n}\n","import { noop } from \"lodash-es\";\nimport type { IZLogEntry } from \"../log-entry/log-entry.mjs\";\nimport type { IZLogger } from \"./logger.mjs\";\n\n/**\n * A silent logger. This logger does nothing.\n */\nexport class ZLoggerSilent implements IZLogger {\n public log: (_: IZLogEntry) => void = noop;\n}\n"],"names":["_class_call_check","ZLogLevel","ZLogEntryBuilder","_define_property","_entry","catastrophe","level","bind","error","warning","info","message","created","Date","toJSON","context","ctx","msg","copy","other","structuredClone","build","ZLoggerComposite","_children","log","entry","forEach","logger","ZLoggerConsole","_logFnMap","_console","CATASTROPHE","ERROR","WARNING","warn","fn","timestamp","toLocaleString","payload","FATAL","ZLoggerContext","_forward","_context","clone","ZLoggerSilent","noop"],"mappings":";;AAAA;;AAEC,IAAA,SAAAA,mBAAA,CAAA,QAAA,EAAA,WAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACM,IAAA,SAAKC,iBAAAA,SAAAA,SAAAA,EAAAA;AACV;;;;;;AAMC,MAAA,SAAA,CAAA,SAAA,CAAA,aAAA,CAAA,GAAA,CAAA,CAAA,GAAA,aAAA;AAGD;;;;;AAKC,MAAA,SAAA,CAAA,SAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAA;AAGD;;;;;;;AAOC,MAAA,SAAA,CAAA,SAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAA;AAGD;;;;;;;;;AASC,MAAA,SAAA,CAAA,SAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAA;AArCSA,IAAAA,OAAAA,SAAAA;AAuCX,CAAA,CAAA,EAAA;AA8BD;;IAGO,IAAMC,gBAAN,iBAAA,WAAA;AAAMA,IAAAA,SAAAA,gBAAAA,GAAAA;AAAAA,QAAAA,mBAAAA,CAAAA,IAAAA,EAAAA,gBAAAA,CAAAA;AACX,QAAAC,kBAAA,CAAA,IAAA,EAAQC,UAAR,MAAA,CAAA;AA2BA;;;;;MAMAD,kBAAA,CAAA,IAAA,EAAOE,eAAc,IAAI,CAACC,KAAK,CAACC,IAAI,CAAC,IAAI,EAAA,CAAA,CAAA,CAAA;AAEzC;;;;;MAMAJ,kBAAA,CAAA,IAAA,EAAOK,SAAQ,IAAI,CAACF,KAAK,CAACC,IAAI,CAAC,IAAI,EAAA,CAAA,CAAA,CAAA;AAEnC;;;;;MAMAJ,k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AUDE,QAAAA,GAAAA,QAAAA;aACAD,QAAAA,GAAAA,QAAAA;;AAXCD,IAAAA,aAAAA,CAAAA,cAAAA,EAAAA;;YAcJhB,GAAAA,EAAAA,KAAAA;AAAP,YAAA,KAAA,EAAA,SAAOA,IAAIC,KAAiB,EAAA;AAC1B,gBAAA,IAAMkB,KAAQ,GAAA,IAAIzC,gBACfgB,EAAAA,CAAAA,IAAI,CAACO,KACLV,CAAAA,CAAAA,OAAO,CAACU,KAAAA,CAAMV,OAAO,IAAI,IAAI,CAAC2B,QAAQ,EACtCrB,KAAK,EAAA;AACR,gBAAA,OAAO,IAAI,CAACoB,QAAQ,CAACjB,GAAG,CAACmB,KAAAA,CAAAA;AAC3B;;;AApBWH,IAAAA,OAAAA,cAAAA;AAqBZ,CAAA;;;;;;;;;;;;;;;;;;;;ACxBD;;AAEC,IACM,IAAA,aAAMI,GAAN,SAAMA,aAAAA,GAAAA;AAAAA,IAAAA,iBAAAA,CAAAA,IAAAA,EAAAA,aAAAA,CAAAA;AACX,IAAA,gBAAA,CAAA,IAAA,EAAOpB,KAA+BqB,EAAAA,IAAAA,CAAAA;AACvC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zthun/lumberjacky-log",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "A standard log interface between different logging standards.",
|
|
5
5
|
"author": "Anthony Bonta",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,15 +34,15 @@
|
|
|
34
34
|
"lodash-es": "^4.17.21"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@zthun/janitor-build-config": "^19.
|
|
37
|
+
"@zthun/janitor-build-config": "^19.2.4",
|
|
38
38
|
"typescript": "~5.8.3",
|
|
39
39
|
"vite": "^6.3.5",
|
|
40
|
-
"vitest": "^3.2.
|
|
40
|
+
"vitest": "^3.2.4",
|
|
41
41
|
"vitest-mock-extended": "^3.1.0"
|
|
42
42
|
},
|
|
43
43
|
"files": [
|
|
44
44
|
"dist"
|
|
45
45
|
],
|
|
46
46
|
"sideEffects": false,
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "7982ac7db527ad3d4d6d91c76a742dfa74ff4664"
|
|
48
48
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|