Object logging with formatting
All checks were successful
Build / Build NPM Project (push) Successful in 40s
Build / Tag Version (push) Successful in 7s
Build / Publish Documentation (push) Successful in 35s

This commit is contained in:
Zakary Timson 2024-10-16 20:28:56 -04:00
parent 7c5cf3535d
commit cebfd2c508
2 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@ztimson/utils",
"version": "0.20.10",
"version": "0.20.11",
"description": "Utility library",
"author": "Zak Timson",
"license": "MIT",

View File

@ -76,7 +76,7 @@ export class Logger extends TypedEmitter<LoggerEvents> {
private format(...text: any[]): string {
const now = new Date();
const timestamp = `${now.getFullYear()}-${now.getMonth() + 1}-${now.getDate()} ${this.pad(now.getHours().toString(), 2, '0')}:${this.pad(now.getMinutes().toString(), 2, '0')}:${this.pad(now.getSeconds().toString(), 2, '0')}.${this.pad(now.getMilliseconds().toString(), 3, '0', true)}`;
return `${timestamp}${this.namespace ? ` [${this.namespace}]` : ''} ${text.map(JSONSanitize).join(' ')}`;
return `${timestamp}${this.namespace ? ` [${this.namespace}]` : ''} ${text.map(t => typeof t == 'string' ? t : JSONSanitize(t, 2)).join(' ')}`;
}
debug(...args: any[]) {