Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dot-build/logger

Tiny logger utility for Node.JS and web apps
https://github.com/dot-build/logger

Last synced: about 1 month ago
JSON representation

Tiny logger utility for Node.JS and web apps

Awesome Lists containing this project

README

        

# @dotbuild/logger

Tiny logger utility for Node.JS and web apps

## Usage

```js
import { Logger, LogLevel } from '@dot-build/logger'
const logger = new Logger('any-name');

logger.info('Unicorns are real');

// output to `console.log`: Unicorns are real

// Optional. Can be None, Error, Warning, Info, Log, Debug
Logger.setLevel(LogLevel.Info);
```

## Using a different log output

Implement LogOutput interface:

```js
import { Logger, LogOutput } from '@dot-build/logger';

class CustomOutput implements LogOutput {
log(...args) {
// do something with arguments
}
}

Logger.setOutput(new CustomOutput());

```