clean up
This commit is contained in:
@@ -65,7 +65,7 @@ export class Logger {
|
||||
const timestamp = new Date().toISOString();
|
||||
const formattedMessage = this.formatMessage(message, ...optionalParameters);
|
||||
const levelString = LoggingLevelMapping.convertLoggingLevelToLoggingLevelType(level);
|
||||
|
||||
|
||||
// Safely call appenders with error handling
|
||||
this._appenders.forEach(appender => {
|
||||
try {
|
||||
@@ -86,22 +86,23 @@ export class Logger {
|
||||
// More efficient parameter substitution
|
||||
let result = message;
|
||||
let paramIndex = 0;
|
||||
|
||||
|
||||
// Replace all {} placeholders with parameters
|
||||
while (result.includes('{}') && paramIndex < optionalParameters.length) {
|
||||
const paramString = this.parameterToString(optionalParameters[paramIndex]);
|
||||
result = result.replace('{}', paramString);
|
||||
paramIndex++;
|
||||
}
|
||||
|
||||
|
||||
// Append remaining parameters if any
|
||||
if (paramIndex < optionalParameters.length) {
|
||||
const remainingParams = optionalParameters.slice(paramIndex)
|
||||
const remainingParams = optionalParameters
|
||||
.slice(paramIndex)
|
||||
.map(param => this.parameterToString(param))
|
||||
.join(' ');
|
||||
result += ` ${remainingParams}`;
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user