1.4.0 • Published 1 year ago

@spark.ts/logger v1.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Spark Logger

A logger built on TypeScript

Installation

  • To install, run npm i @spark.ts/logger.
  • Usage:

Example Usage

TypeScript / ESM

import { Logger } from '@spark.ts/logger';

const logger = new Logger();
logger.error('An error occured');

CommonJS

const { Logger } = require('@spark.ts/logger');

const logger = new Logger();
logger.error('An error occured');

NOTE: You can use all of the functions from the regular console, such as console.log('hello world') becomes logger.log('hello world')

Types

  • There are built-in type declarations, the options for new Logger(); are below:
new Logger({
  logLevel: 'success' | 'error' | 'warn' | 'info' | 'debug', // Defaults to 'debug'
  logStyle: 'highlight' | 'bracket', // Defaults to 'highlight'

  // Optional custom messages for the logger. Use {msg} to represent the thing being logged
  messages: {
    success: 'SUCCESS: {msg}',
    error: 'ERROR: {msg}',
    warn: 'WARN: {msg}',
    info: 'INFO: {msg}',
    debug: 'DEBUG: {msg}',
  }
});

Images

Highlight Style:

npm.io

Bracket Style:

npm.io

1.3.7

1 year ago

1.3.6

1 year ago

1.4.0

1 year ago

1.3.5

2 years ago

1.3.4

2 years ago

1.3.3

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.9

2 years ago

1.2.8

2 years ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago