Skip to content

Support for removing color coding #232

Open
@Shooshte

Description

@Shooshte

When writing log files into a .log file escape characters get added before each line. This bloats the log file considerably, and makes it a bit harder to read.

My logger config:

import logdown from 'logdown';
import fs from 'fs';

const output = fs.createWriteStream('./stdout.log');
const errorOutput = fs.createWriteStream('./stderr.log');
const fileLogger = new console.Console(output, errorOutput);

const logger = logdown('API', {
  logger: fileLogger,
  markdown: false,
  plaintext: true
});

logger.state.isEnabled = true;

export default logger;

Usage example and output:

logger.log(`app started on port: ${PORT}`);
�[37m �[39m  [API] app started on port: 3000

I believe this is due to whitespace and colour coding being added to the passed string (inside the console there is whitespace and the text colour is green).
Can support be for the plaintext to remove the formatting or would this be better suited for a plugin?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions