All Projects → igo → Nlogger

igo / Nlogger

Logging lib for Node.js that prints also module name and line number

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Nlogger

Testlogcollectors
A framework for capturing log statements during tests. Compatible with most popular logging frameworks. Works with JUnit and TestNG
Stars: ✭ 31 (-40.38%)
Mutual labels:  logging
Fliplog
fluent logging with verbose insight, colors, tables, emoji, filtering, spinners, progress bars, timestamps, capturing, stack traces, tracking, presets, & more...
Stars: ✭ 41 (-21.15%)
Mutual labels:  logging
Log4cplus
log4cplus is a simple to use C++ logging API providing thread-safe, flexible, and arbitrarily granular control over log management and configuration. It is modelled after the Java log4j API.
Stars: ✭ 1,054 (+1926.92%)
Mutual labels:  logging
Lumberjack
A terminal-ui log watcher written in Go using the Flux architecture
Stars: ✭ 31 (-40.38%)
Mutual labels:  logging
Reqray
Log call tree summaries after each request for rust programs instrumented with `tracing`.
Stars: ✭ 37 (-28.85%)
Mutual labels:  logging
Log
Logging implementation for Rust
Stars: ✭ 1,012 (+1846.15%)
Mutual labels:  logging
Dotlog
Simple and easy go log framework
Stars: ✭ 30 (-42.31%)
Mutual labels:  logging
Lager
A logging framework for Erlang/OTP
Stars: ✭ 1,060 (+1938.46%)
Mutual labels:  logging
Tron
R package for easy logging
Stars: ✭ 38 (-26.92%)
Mutual labels:  logging
Qtwebapp
QtWebApp is a HTTP server like Java servlets, written in C++ with the Qt framework.
Stars: ✭ 50 (-3.85%)
Mutual labels:  logging
Loglevelnext
A modern logging library for Node.js that provides log level mapping to the console
Stars: ✭ 33 (-36.54%)
Mutual labels:  logging
Log4jwebtracker
Java web tool to setup at runtime the log level of Log4j appenders in an application, and read the log at runtime.
Stars: ✭ 35 (-32.69%)
Mutual labels:  logging
Logdown.js
✏️ Debug utility with markdown support that runs on browser and server
Stars: ✭ 1,013 (+1848.08%)
Mutual labels:  logging
Nlog.xlogger
A C# .NET class library that extends NLog.Logger to provide additional functionality for tracing the entry and exit, arbitrary checkpoints, exceptions and stack traces within methods.
Stars: ✭ 31 (-40.38%)
Mutual labels:  logging
Serverless Es Logs
A Serverless plugin to transport logs to ElasticSearch
Stars: ✭ 51 (-1.92%)
Mutual labels:  logging
Escriba
📜 Logging on steroids
Stars: ✭ 30 (-42.31%)
Mutual labels:  logging
Log4j2 Ttl Thread Context Map
🌳 Log4j2 TTL ThreadContextMap, Log4j2 extension integrated TransmittableThreadLocal to MDC
Stars: ✭ 41 (-21.15%)
Mutual labels:  logging
Raspberrypi tempmon
Raspberry pi CPU temperature monitor with many functions such as logging, GPIO output, graphing, email, alarm, notifications and stress testing. Python 3.
Stars: ✭ 52 (+0%)
Mutual labels:  logging
Plog
Portable, simple and extensible C++ logging library
Stars: ✭ 1,061 (+1940.38%)
Mutual labels:  logging
Browser Logger
A dead simple logger, designed to be perfect for the browser.
Stars: ✭ 44 (-15.38%)
Mutual labels:  logging

nlogger

nlogger is a Node.js logging library that can

  • print messages with module name and current line number so you know from where it was called
  • print messages in color
  • print parameters in message
  • be configured from file

Usage

Use npm or download. Then add to your code:

var logger = require('nlogger').logger(module);

module is object defined automatically by Node.js. If you don't want automatic module names, replace it with your desired string name.

logger.info(message);
logger.info(message, variable, message, variable...);

Examples

var logger = require('nlogger').logger(module);
logger.info('Info message');
logger.debug('Debug message');
logger.warn('Warning message');
logger.error('Error message');
logger.trace('Trace message');
logger.info('Array = ', [1, 2, 3, 4], ', Object = ', {one: 1, two: 2});

Output samples

2015-02-23 20:39:03.570 INFO  main:5 - Info message
2015-02-23 20:39:03.588 DEBUG main:6 - Debug message
2015-02-23 20:39:03.589 WARN  main:7 - Warning message
2015-02-23 20:39:03.590 ERROR main:8 - Error message
2015-02-23 20:39:03.590 TRACE main:9 - Trace message
2015-02-23 20:39:03.590 INFO  main:10 - Array = [ 1, 2, 3, 4 ], Object = { one: 1, two: 2 }

2015-02-23 20:59:12.496 INFO  my-modules/first:3 - Message from first module from line #3
2015-02-23 20:59:12.514 INFO  my-modules/second:10 - Message from second module from line #10
2015-02-23 20:59:12.515 INFO  fake-module-name:3 - Message from third module from line #3
2015-02-23 20:59:12.516 INFO  <unknown>:3 - Message from fourth module from line #3

Configuration

nlogger can load optional configuration file nlogger.json which looks like:

{
	"color": "auto",
	"level": {
		"*": "debug",
		"my-modules/first": "info"
	}
}
  • color - print message in color? [true, false, "auto"]
  • level.* - default debug level
  • level.yourModuleName - log level for specified module

Possible log levels are trace, debug, info, warn, error.

Changes

1.0.0 - Compatibility with latest node.js 0.12.x

0.4.0 - Logging methods parameters changed

0.3.1 - Fixed util dependencies

0.3.0 - Added parameters support to logging methods

0.2.0 - Added configuration file support

0.1.0 - First npm release

License

Commercial license available at http://iostock.com/nlogger

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].