@tsed/logger
Advanced tools
Comparing version 5.16.0 to 5.17.0
@@ -413,2 +413,16 @@ var tslib = require('tslib'); | ||
var id = 0; | ||
function _classPrivateFieldLooseKey(name) { | ||
return "__private_" + id++ + "_" + name; | ||
} | ||
function _classPrivateFieldLooseBase(receiver, privateKey) { | ||
if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { | ||
throw new TypeError("attempted to use private field on non-instance"); | ||
} | ||
return receiver; | ||
} | ||
class LogContext extends Map { | ||
@@ -1234,2 +1248,6 @@ toJSON() { | ||
}; | ||
this.formatJson = loggingEvent => { | ||
return JSON.stringify(loggingEvent.data); | ||
}; | ||
/** | ||
@@ -1345,2 +1363,3 @@ * | ||
m: this.formatMessage, | ||
j: this.formatJson, | ||
n: this.endOfLine, | ||
@@ -1360,3 +1379,4 @@ p: this.logLevel, | ||
const regex = /%(-?[0-9]+)?(\.?[0-9]+)?([[\]cdhmnprzxy%])(\{([^}]+)\})?|([^%]+)/; | ||
var _replacers, _tokens, _pattern; | ||
const regex = /%(-?[0-9]+)?(\.?[0-9]+)?([[\]cdhmnpjrzxy%])(\{([^}]+)\})?|([^%]+)/; | ||
const TTCC_CONVERSION_PATTERN = "%r %p %c - %m%n"; | ||
@@ -1373,2 +1393,3 @@ /** | ||
* - %m log data | ||
* - %j log data as JSON | ||
* - %d date in constious formats | ||
@@ -1397,14 +1418,27 @@ * - %% % | ||
exports.PatternLayout = class PatternLayout extends BaseLayout { | ||
exports.PatternLayout = (_replacers = /*#__PURE__*/_classPrivateFieldLooseKey("replacers"), _tokens = /*#__PURE__*/_classPrivateFieldLooseKey("tokens"), _pattern = /*#__PURE__*/_classPrivateFieldLooseKey("pattern"), class PatternLayout extends BaseLayout { | ||
constructor(config) { | ||
super(config); | ||
Object.defineProperty(this, _replacers, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
Object.defineProperty(this, _tokens, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
Object.defineProperty(this, _pattern, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
this.replaceToken = (conversionCharacter, loggingEvent, specifier) => { | ||
return this._replacers[conversionCharacter](loggingEvent, specifier); | ||
return _classPrivateFieldLooseBase(this, _replacers)[_replacers][conversionCharacter](loggingEvent, specifier); | ||
}; | ||
this.pattern = config && config.pattern || TTCC_CONVERSION_PATTERN; | ||
this.tokens = config && config.tokens; | ||
this._replacers = new LayoutReplacer(this.tokens, this.config.timezoneOffset).build(); | ||
_classPrivateFieldLooseBase(this, _pattern)[_pattern] = config && config.pattern || TTCC_CONVERSION_PATTERN; | ||
_classPrivateFieldLooseBase(this, _tokens)[_tokens] = config && config.tokens; | ||
_classPrivateFieldLooseBase(this, _replacers)[_replacers] = new LayoutReplacer(_classPrivateFieldLooseBase(this, _tokens)[_tokens], this.config.timezoneOffset).build(); | ||
} | ||
/** | ||
@@ -1416,10 +1450,10 @@ * | ||
*/ | ||
transform(loggingEvent, timezoneOffset) { | ||
let formattedString = ""; | ||
let result; | ||
let searchString = this.pattern; | ||
let searchString = _classPrivateFieldLooseBase(this, _pattern)[_pattern]; | ||
/* eslint no-cond-assign:0 */ | ||
while ((result = regex.exec(searchString)) !== null) { | ||
@@ -1448,3 +1482,3 @@ // const matchedString = result[0]; | ||
}; | ||
}); | ||
exports.PatternLayout = tslib.__decorate([Layout({ | ||
@@ -1451,0 +1485,0 @@ name: "pattern" |
@@ -389,2 +389,16 @@ import { __decorate, __metadata } from 'tslib'; | ||
var id = 0; | ||
function _classPrivateFieldLooseKey(name) { | ||
return "__private_" + id++ + "_" + name; | ||
} | ||
function _classPrivateFieldLooseBase(receiver, privateKey) { | ||
if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { | ||
throw new TypeError("attempted to use private field on non-instance"); | ||
} | ||
return receiver; | ||
} | ||
class LogContext extends Map { | ||
@@ -1210,2 +1224,6 @@ toJSON() { | ||
}; | ||
this.formatJson = loggingEvent => { | ||
return JSON.stringify(loggingEvent.data); | ||
}; | ||
/** | ||
@@ -1321,2 +1339,3 @@ * | ||
m: this.formatMessage, | ||
j: this.formatJson, | ||
n: this.endOfLine, | ||
@@ -1336,3 +1355,4 @@ p: this.logLevel, | ||
const regex = /%(-?[0-9]+)?(\.?[0-9]+)?([[\]cdhmnprzxy%])(\{([^}]+)\})?|([^%]+)/; | ||
var _replacers, _tokens, _pattern; | ||
const regex = /%(-?[0-9]+)?(\.?[0-9]+)?([[\]cdhmnpjrzxy%])(\{([^}]+)\})?|([^%]+)/; | ||
const TTCC_CONVERSION_PATTERN = "%r %p %c - %m%n"; | ||
@@ -1349,2 +1369,3 @@ /** | ||
* - %m log data | ||
* - %j log data as JSON | ||
* - %d date in constious formats | ||
@@ -1373,14 +1394,27 @@ * - %% % | ||
let PatternLayout = class PatternLayout extends BaseLayout { | ||
let PatternLayout = (_replacers = /*#__PURE__*/_classPrivateFieldLooseKey("replacers"), _tokens = /*#__PURE__*/_classPrivateFieldLooseKey("tokens"), _pattern = /*#__PURE__*/_classPrivateFieldLooseKey("pattern"), class PatternLayout extends BaseLayout { | ||
constructor(config) { | ||
super(config); | ||
Object.defineProperty(this, _replacers, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
Object.defineProperty(this, _tokens, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
Object.defineProperty(this, _pattern, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
this.replaceToken = (conversionCharacter, loggingEvent, specifier) => { | ||
return this._replacers[conversionCharacter](loggingEvent, specifier); | ||
return _classPrivateFieldLooseBase(this, _replacers)[_replacers][conversionCharacter](loggingEvent, specifier); | ||
}; | ||
this.pattern = config && config.pattern || TTCC_CONVERSION_PATTERN; | ||
this.tokens = config && config.tokens; | ||
this._replacers = new LayoutReplacer(this.tokens, this.config.timezoneOffset).build(); | ||
_classPrivateFieldLooseBase(this, _pattern)[_pattern] = config && config.pattern || TTCC_CONVERSION_PATTERN; | ||
_classPrivateFieldLooseBase(this, _tokens)[_tokens] = config && config.tokens; | ||
_classPrivateFieldLooseBase(this, _replacers)[_replacers] = new LayoutReplacer(_classPrivateFieldLooseBase(this, _tokens)[_tokens], this.config.timezoneOffset).build(); | ||
} | ||
/** | ||
@@ -1392,10 +1426,10 @@ * | ||
*/ | ||
transform(loggingEvent, timezoneOffset) { | ||
let formattedString = ""; | ||
let result; | ||
let searchString = this.pattern; | ||
let searchString = _classPrivateFieldLooseBase(this, _pattern)[_pattern]; | ||
/* eslint no-cond-assign:0 */ | ||
while ((result = regex.exec(searchString)) !== null) { | ||
@@ -1424,3 +1458,3 @@ // const matchedString = result[0]; | ||
}; | ||
}); | ||
PatternLayout = __decorate([Layout({ | ||
@@ -1427,0 +1461,0 @@ name: "pattern" |
@@ -33,2 +33,3 @@ import { LogEvent } from "../../core/LogEvent"; | ||
formatMessage: (loggingEvent: LogEvent) => string; | ||
formatJson: (loggingEvent: LogEvent) => string; | ||
/** | ||
@@ -35,0 +36,0 @@ * |
@@ -14,2 +14,3 @@ import { BaseLayout } from "../class/BaseLayout"; | ||
* - %m log data | ||
* - %j log data as JSON | ||
* - %d date in constious formats | ||
@@ -38,5 +39,3 @@ * - %% % | ||
export declare class PatternLayout extends BaseLayout { | ||
private _replacers; | ||
private tokens; | ||
private pattern; | ||
#private; | ||
constructor(config: IBasicLayoutConfiguration); | ||
@@ -43,0 +42,0 @@ /** |
{ | ||
"name": "@tsed/logger", | ||
"version": "5.16.0", | ||
"version": "5.17.0", | ||
"description": "A multi channel logger written in TypeScript.", | ||
@@ -5,0 +5,0 @@ "private": false, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
246788
3363
0