1.0.15 • Published 4 months ago

console-locale-timestamp v1.0.15

Weekly downloads
77
License
MIT
Repository
github
Last release
4 months ago

Console with locale timestamp

npm version test status

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 arguments

constructor(locales?: string, options?: object, quote?: string[], separator?: string)
nametypedeaultexampleDescription
localesstringundefined'en-US'The specified value will be used as the first argument of Date.prototype.toLocaleTimeString().
optionsobjectundefined{ minute: '2-digit', second: '2-digit' }The specified value will be used as the second argument of Date.prototype.toLocaleTimeString().
quotestring[]''['', '']The characters that surround the timestamp. If you omit the second value, the same characters as the first are applied.
separatorstring''' - 'Delimiter between the timestamp and the message that follows.

Methods

1.0.15

4 months ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago