1.0.2 • Published 9 months ago

stumper v1.0.2

Weekly downloads
-
License
GPLV3
Repository
github
Last release
9 months ago

Stumper

A simple and small logger written in Typescript

Installation

npm install stumper

Usage

Configuration

import Stumper, { LOG_LEVEL } from "stumper";

Stumper.setConfig({logLevel: LOG_LEVEL.ALL});
ParameterOptionsDefaultDescription
useColorsTrue/FalsetrueIf the log should use colors.
useTimestampsTrue/FalsetrueIf the log should include timestamps.
timezoneLocal/UTCLocalThe timezone that the log will use. Either your local time or UTC. Only matters if useTimestamps is true.
logLevelError/Warning/Info/AllErrorThe level of logs to print to the logs. This value can be changed on the fly.
Stumper.setLogLevel(LOG_LEVEL.WARNING);
Stumper.getLogLevel();

Logging Methods

All logging methods take the same parameters.

ParameterTypeRequiredDescription
dataanyYesThe log message to be sent. Objects and arrays will be stringified.
indentifierstringNoCan be used to identify where in the code a log statement is coming from. For example the identifier could be set to the method name.

Below are the 4 different logging methods and the colors that correspond with them. | Method | Color | | ------------- | ------------- | | error | Red | | warning | Yellow | | info | Blue | | debug | White |

Examples

Stumper.error("This is an error with an identifier", "main");
Stumper.error("This is an error without an identifier");

Stumper.warning("This is a warning");
Stumper.info("This is an info message");
Stumper.debug("This is a debug log message");
1.0.2

9 months ago

1.0.1

11 months ago

1.0.0

11 months ago