1.2.6 • Published 7 years ago

log-log v1.2.6

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

log-log

Easy and friendly logging with timestamp

Installation

$ npm install log-log

Examples

Ready to go

var LogLog = require('log-log');
var log = LogLog.create();

log.debug("Debug some stuff");

Simple demo

var log = LogLog.create({applicationName: "Demo", color: LogLog.COLORS.CYAN});

log.debug("Hello!");

log.changeColor(LogLog.COLORS.DEFAULT);

log.error("Sample error");
log.warning("Sample warning");
log.success("Sample success");
log.test("Sample test");

example

Creating a new instance

LogLog.create(logOptions)

  • logOptions Object used to pass a few logging options, all properties are optional
    • applicationName Name given to your LogLog instance, useful to distinguish classes and objects
    • color You can access available colors from LogLog.COLORS object
    • dim Default set to false, useful if you don't want logs to stand out too much

create will return a Logs instance. This object will have the following methods

Methods

debug(message, depthLevel)

  • message {String | Object}
  • depthLevel {Number} Optional

When passing objects they get stringified

error(message) | warning | success | test

  • message {String | Object}

When passing objects they get stringified

disableDebug() | enableDebug()

Will affect only .debug messages

isDebugEnabled()

Boolean returned

setDepthLevel(level)

  • level {Number}

You can specify debug depth level in order to filter unwanted deep debug messages

changeColor(color)

  • color {String}

You can access available colors from LogLog.COLORS object

1.2.6

7 years ago

1.2.5

7 years ago

1.2.4

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

9 years ago