This package has been deprecated

Author message:

dead project

cuboid

1.2.1 • Public • Published

Cuboid Logo

What is Cuboid?

Cuboid is a elegant, fluent, and powerful logging library for Node JS
It is made to be easy to use, while keeping the powerful logging most developers need

Installation

npm install cuboid

Usage

const Cuboid = require("cuboid");
// First parameter is weather or not to use 24 hour time
// Second parameter is if you want your logs colored
// Third parameter is if you want to include date in your logs
// Fourth parameter is if you want to output logs to a file as well
// Last parameter is the output directory if you want log files
const Logger = new Cuboid(true, true, false, false, "");

Logger
    .info("this is a info message")
    .warning("this is a warning message")
    .error("this is a error message")
    .debug("this is a debug message");

Plugin Api

The cuboid plugin api allows users to create 'plugins' that run on each type of log level
It constists of 5 events: info, error, warning, debug, and initialize

The info event is ran when the info log function is ran
The error event is ran when the error log function is ran
The warning event is ran when the warning log function is ran
The debug event is ran when the debug log function is ran
The initialize event is called when the plugin is enabled

Each log event has the parameters of the time/date of the log, as well as the message

const example = {
    initialize: function()
    {
        console.log("example plugin enabled");
    },
    info(timestamp, message)
    {
        console.log(message + " happened at " + timestamp);
    },
    warning(timestamp, message)
    {
        console.log(message + " happened at " + timestamp);
    },
    error(timestamp, message)
    {
        console.log(message + " happened at " + timestamp);
    },
    debug(timestamp, message)
    {
        console.log(message + " happened at " + timestamp);
    }
};

const Cuboid = require("cuboid");
const Logger = new Cuboid(true, true, false, false, "");

Logger.use(example);

Logger
    .info("this is a info message")
    .warning("this is a warning message")
    .error("this is a error message")
    .debug("this is a debug message");

Package Sidebar

Install

npm i cuboid

Weekly Downloads

1

Version

1.2.1

License

GPL-3.0

Unpacked Size

43.3 kB

Total Files

4

Last publish

Collaborators

  • falsedata