2.1.1 • Published 3 months ago

@arch-herobrine/logger.js v2.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

Logger-js

Installation

$ npm install @arch-herobrine/logger.js

Usage

import Logger from "@arch-herobrine/logger.js"

const logger = new Logger({timeZone:"UTC"});

logger.log("this is log");
// -> [ log --- 2024/01/31 16:00:00 (UTC+00:00) ] this is log
logger.log("new\nline");
// -> [ log --- 2024/01/31 16:00:00 (UTC+00:00) ]
//    new
//    line

Class(es)

Logger

Constructor

new Logger(options: LoggerOptions);

options

ParameterTypeOptionalDefaultDescription
timeZoneString"UTC"Time zone used for logs

Methods

.log(message?,...optionalParams)

Output log to console. |Parametar|Type|Optional|Default|Description| |--|--|--|--|--| |message|any|✓|none|Almost the same as console.log().| |optionalParams|any|✓|none|Almost the same as console.log().|

.info(message?,...optionalParams)

Output info log to console. |Parametar|Type|Optional|Default|Description| |--|--|--|--|--| |message|any|✓|none|Almost the same as console.log().| |optionalParams|any|✓|none|Almost the same as console.log().|

.warn(message?,...optionalParams)

Output warn log to console. |Parametar|Type|optional|Default|Description| |--|--|--|--|--| |message|any|✓|none|Almost the same as console.warn().| |optionalParams|any|✓|none|Almost the same as console.warn().|

.error(message?,...optionalParams)

Output error log to console. |Parametar|Type|Optional|Default|Description| |--|--|--|--|--| |message|any|✓|none|Almost the same as console.error().| |optionalParams|any|✓|none|Almost the same as console.error().|

Events

log

Emitted whenever the function Logger.log() is executed. |Parameter|Type|Description| |--|--|--| |log|string|String output to console.|

infoLog

Emitted whenever the function Logger.info() is executed. |Parameter|Type|Description| |--|--|--| |log|string|String output to console.|

warnLog

Emitted whenever the function Logger.warn() is executed. |Parameter|Type|Description| |--|--|--| |log|string|String output to console.|

errorLog

Emitted whenever the function Logger.error() is executed. |Parameter|Type|Description| |--|--|--| |log|string|String output to console.|

2.1.1

3 months ago

2.1.0

3 months ago

2.0.3

3 months ago

2.0.2

3 months ago

2.0.5

3 months ago

2.0.4

3 months ago

2.0.1

3 months ago

2.0.0

3 months ago

1.1.0

3 months ago

1.0.0

3 months ago

0.3.2

3 months ago

0.3.1

3 months ago

0.3.0

3 months ago

0.2.0

3 months ago

0.1.1

3 months ago

0.1.0

3 months ago