1.1.0 • Published 11 months ago
console-locale-timestamp v1.1.0
Console with locale timestamp
Provides a console debugging facilities with a timestamp. Timestamps are written using Date.prototype.toLocaleTimeString().
All public methods have the same functionality as the Console.
Sample
JavaScript
import Console from 'console-locale-timestamp';
const console1 = new Console();
console1.debug('Hello World!');
console1.table({
1001: { name: 'John Smith', age: '20' },
1002: { name: 'Taro Yamada', age: '25' },
});
const console2 = new Console('en-US', { minute: '2-digit', second: '2-digit' }, ['[', ']'], ' - ');
console2.debug('Hello World!');
console2.table({
1001: { name: 'John Smith', age: '20' },
1002: { name: 'Taro Yamada', age: '25' },
});Console
0:00:00 Hello World!
0:00:01
┌─────────┬───────────────┬──────┐
│ (index) │ name │ age │
├─────────┼───────────────┼──────┤
│ 1001 │ 'John Smith' │ '20' │
│ 1002 │ 'Taro Yamada' │ '25' │
└─────────┴───────────────┴──────┘
[00:02] - Hello World!
[00:03]
┌─────────┬───────────────┬──────┐
│ (index) │ name │ age │
├─────────┼───────────────┼──────┤
│ 1001 │ 'John Smith' │ '20' │
│ 1002 │ 'Taro Yamada' │ '25' │
└─────────┴───────────────┴──────┘Constructor
constructor(locales?: string, options?: Readonly<Intl.DateTimeFormatOptions>, quote?: [string, string?], separator?: string)Parameters
Methods
assert(condition?: boolean, ...data: any[]): voidclear(): voiddebug(...data: any[]): voiderror(...data: any[]): voidinfo(...data: any[]): voidlog(...data: any[]): voidtable(tabularData?: any, properties?: string[]): voidtrace(...data: any[]): voidwarn(...data: any[]): voiddir(item?: any, options?: any): voiddirxml(...data: any[]): voidcount(label?: string): voidcountReset(label?: string): voidgroup(...data: any[]): voidgroupCollapsed(...data: any[]): voidgroupEnd(): voidtime(label?: string): voidtimeLog(label?: string, ...data: any[]): voidtimeEnd(label?: string): void