style-logger
A very basic, isomorphic logger that accepts a style function object that can be used to provide colour output to stdout using ANSI escape sequences in node or CSS
style fomatting foe console.log
.
Usage
npm install style-logger
StyleLogger([{WriteStream}[, {object}]]) optionaly takes a stream and a style functions object and returns a logger
Builds a logger complex including the provided styles and returns a customisable, logger complex including customisation methods. If no write stream is provided it will log to stdout
.
const StyleLogger = { var ESC = '\x1b[' gEND = "m" allOFF = `0m` BOLD = 1 ITALIC = 3 UNDERLINE = 4 IMAGENEGATIVE = 7 FONTDEFAULT = 10 FONT2 = 11 FONT3 = 12 FONT4 = 13 FONT5 = 14 FONT6 = 15 IMAGEPOSITIVE = 27 BLACK = 30 RED = 31 GREEN = 32 YELLOW = 33 BLUE = 34 MAGENTA = 35 CYAN = 36 WHITE = 37 BG_BLACK = 40 BG_RED = 41 BG_GREEN = 42 BG_YELLOW = 43 BG_BLUE = 44 BG_MAGENTA = 45 BG_CYAN = 46 BG_WHITE = 47 CLEAR_SCREEN = `2J`; var ansiStyles = `;m` `;m` `;m` ; var cssRed = '#c04848' cssBlue = '#07c' cssYellow = '#ead10e'; var cssStyles = `%c` `font-weight: bold; color: ` `%c` `font-weight: bold; color: ` `%c` `font-weight: bold; color: ` ; return } // If a logStream is not provided, logs to stdout var log = ; // returns styled logs... log log log // or default vanilla // with or without escape sequences (for non-TTY output) log; log; // enable or dissable log; log; // apply a transform to the message before it is wrapped log // provide a callback for async operation log // will call back after write is completed // also provides events for finnish and errors log