logo

Logger

This is a collection of functions for working with loggers.

Get ANSI color for level

The getLoggerAnsiColor function returns the ANSI color for a logger level, the level can be debug, error, info, verbose or warn.

import { getLoggerAnsiColor } from '@aracna/core';

// will log "\x1b[35m"
console.log(getLoggerAnsiColor('debug'));

// will log "\x1b[31m"
console.log(getLoggerAnsiColor('error'));

// will log "\x1b[34m"
console.log(getLoggerAnsiColor('info'));

// will log "\x1b[37m"
console.log(getLoggerAnsiColor('verbose'));

// will log "\x1b[33m"
console.log(getLoggerAnsiColor('warn'));