Handle logging objects
This commit is contained in:
		@@ -1,6 +1,6 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	"name": "@ztimson/utils",
 | 
						"name": "@ztimson/utils",
 | 
				
			||||||
	"version": "0.20.8",
 | 
						"version": "0.20.9",
 | 
				
			||||||
	"description": "Utility library",
 | 
						"description": "Utility library",
 | 
				
			||||||
	"author": "Zak Timson",
 | 
						"author": "Zak Timson",
 | 
				
			||||||
	"license": "MIT",
 | 
						"license": "MIT",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,5 @@
 | 
				
			|||||||
import {TypedEmitter, TypedEvents} from './emitter';
 | 
					import {TypedEmitter, TypedEvents} from './emitter';
 | 
				
			||||||
 | 
					import {JSONSanitize} from './objects.ts';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const CliEffects = {
 | 
					export const CliEffects = {
 | 
				
			||||||
	CLEAR: "\x1b[0m",
 | 
						CLEAR: "\x1b[0m",
 | 
				
			||||||
@@ -75,7 +76,7 @@ export class Logger extends TypedEmitter<LoggerEvents> {
 | 
				
			|||||||
	private format(...text: string[]): string {
 | 
						private format(...text: string[]): string {
 | 
				
			||||||
		const now = new Date();
 | 
							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)}`;
 | 
							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.join(' ')}`;
 | 
							return `${timestamp}${this.namespace ? ` [${this.namespace}]` : ''} ${text.map(JSONSanitize).join(' ')}`;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	debug(...args: string[]) {
 | 
						debug(...args: string[]) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user