1.0.0 • Published 1 year ago
sunami-logger v1.0.0
@sunamillc/logger
This is a customer logger for Sunami LLC. This logger only prints to the console, it does not store logs in a database or file.
Installation
Run: npm install @sunamillc/logger
Usage
import { logger } from '@sunamillc/logger';
logger({ type: LOG_TYPE.INFO, message: 'This is an info message' });
Log Types
There are four log types:
0
for ERROR: Something broke1
for WARNING: Something went wrong, but the process should continue2
for INFO: Should be used sparingly for important information3
for DEBUG: Should be used temporarily and never committed to the repo
You can store them locally as an enum:
export enum LOG_TYPE {
ERROR,
WARNING,
INFO,
DEBUG,
}
Log Level
Logging Levels determine which logs appear based on a specified level.
There are three log levels
- MINIMAL
- STANDARD
- DEBUG
You can store them locally as an enum:
export enum LOG_LEVEL {
MINIMAL = 'MINIMAL',
STANDARD = 'STANDARD',
DEBUG = 'DEBUG',
}
Displaying Logs
- Error and Warning logs are always shown or when the log level is MINIMAL.
- Info Logs are shown when the log level is STANDARD or DEBUG.
- Debug logs are only shown when the log level is DEBUG.
1.0.0
1 year ago