Wondering what’s next for npm?Check out our public roadmap! »

    tomodachi

    1.0.1 • Public • Published

    tomodachi

    friendly and customizable logging for node.js

    const tomodachi = require('tomodachi');
    const tty = tomodachi();
     
    tty.log('hello!');

    installation

    this module is available in the npm repository.

    you can install the module with either of the following commands, depending on which package manager you use:

    yarn add tomodachi

    npm install tomodachi

    configuration

    configuration can be done in one of 2 places: in a .tomorc file, or in the arguments of the initial tomodachi function.

    if both are set, the argument configuration will take priority.

    timestamp.format

    moment.js format string for timestamps

    default: HH:mm:ss

    timestamp.(rgb || hex)

    the colour to use for timestamps

    default: timestamp.hex = '#333333'; (equal to timestamp.rgb = [51,51,51];)

    events

    an array of event objects to use for logging

    event object can have the following properties:

    event.name

    the name of the event. will be used for the prefix in logged messages.

    event.(rgb || hex)

    the colour to use for this event's prefix.

    event.default

    flag signifying this event is the default one

    api

    *examples are given using default settings.

    tomodachi.log(string, event)

    logs the given string to the console with given event's settings

    the string logged will be in this format:

    [timestamp] [event name]: [string to log]
    

    tomodachi.(fg | bg).(rgb | hex)

    returns a terminal-coloured string with escape codes

    const blue = tomodachi.fg.rgb([0, 0, 255]); // or .hex('#0000ff');
     
    blue('hi!'); // returns \x1b[38;2;0;0;255mhi!\x1b[39m

    license

    this program is licensed GPL-3.0-or-later

    please click here or view the ./LICENSE file in this repository for more information

    Keywords

    none

    Install

    npm i tomodachi

    DownloadsWeekly Downloads

    1

    Version

    1.0.1

    License

    GPL-3.0-or-later

    Unpacked Size

    43.9 kB

    Total Files

    10

    Last publish

    Collaborators

    • avatar