friendly and customizable logger for nodejs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
neko d8a211a279 update repository 1 month ago
lib fix bug with loading log events 3 months ago
.gitignore add gitignore 3 months ago
LICENSE add license 3 months ago
README.md add documentation to readme 3 months ago
package.json update repository 1 month ago
xo.config.js fix max-depth 3 months ago
yarn.lock add deps supports-color and color-convert 3 months ago

README.md

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