simple-clogger
TypeScript icon, indicating that this package has built-in type declarations

1.0.9 • Public • Published

Simplistic Logging with colors and custom transport support

Installation

From NPM

npm install simple-clogger

Typescript

import * as logger from "simple-clogger";

Javascript

var logger = require("simple-clogger");

Usage

First you can enable console output

logger.enableConsole();

You can use the create function to generate a function that you can call to log data.

It takes an option array, with a property called name. The name should be the source of the log message.

var log = logger.create({Name: "Main App"});
log("Got Array", {Hello: "World", PI: 3.14});

And it will print something like this

2017-04-09 04:17:23PM | [Main App] Got Array
2017-04-09 04:17:23PM | [Main App]         { Hello: 'World', PI: 3.14 }

Custom Transports

You can add custom transports that will trigger when a message needs to be sent

logger.addTextTransport(function(string) {
	socket.send(string);
});

/simple-clogger/

    Package Sidebar

    Install

    npm i simple-clogger

    Weekly Downloads

    0

    Version

    1.0.9

    License

    ISC

    Unpacked Size

    9.88 kB

    Total Files

    9

    Last publish

    Collaborators

    • zzarzzur