KO
|
EN
gitlite — search
Search
#python
#hacktoberfest
#java
#php
#ruby
#javascript
#docker
#android
#deprecated
#node
#go
#email
node-logmagic
★ 82
Open GitHub ↗
Lighweight Logging Module for Node.js
Download README (.md)
Explore Similar Repositories
Fast-Factorial-Functions
:
Swing, divide and conquer the factorial!
mutt-ics
:
Simple viewer for ics in mutt
DoctrineMongoODMModule
:
Laminas Module for Doctrine MongoDB ODM
node-pdc
:
node.js pandoc wrapper
DaisyDiff
:
Visual :white_flower: comparison of HTML in :coffee: Java
// repository documentation
Was this content helpful?
★ 0
(0 ratings)
Select Rating:
★
★
★
★
★
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
node-logmagic
?
Download (.md)
Welcome to Log Magic. ==================== This project is stable. It is used in production by various companies. The goal is to have a fast and easy to use logging subsystem that can be dynamically reconfigured to provide insight into production systems. It supports being used from within a normal Node.js, [Electron Application](http://electron.atom.io/), or in a Web Browser (via [Browserify](http://browserify.org/)). Logmagic does its magic by generating objects with generated functions that are only modified when the logging system is reconfigured, thus your entire logging path is contained within long-lived functions that v8/JS engines are able to JIT. Getting Started ==================== If you had a file named like, "lib/foo/bar.js", at the top of it, you would put the following: var log = require('logmagic').local('mylib.foo.bar'); Then inside bar.js, you would just use the logger like any normal logger: log.info("Hello!") log.error("By default, format strings are not used.", {SOME_VAR: "myvalue"}) log.errorf("Just add 'f' to any log method, and you get format strings too: ${SOME_VAR}", {SOME_VAR: "myvalue"}) In any other part of your application, you can reconfigure the logging subsystem at runtime, making it easy to change log levels for specific modules dynamically. var logmagic = require('logmagic'); logmagic.registerSink("mysink", function(module, level, message) { console.log(message); }); /* Send Info an higher in the root logger to stdout */ logmagic.route("__root__", logmagic.INFO, "stdout") /* Reconfigure all children of mylib to log all debug messages to your custom sink */ logmagic.route("mylib.*", logmagic.DEBUG, "mysink") Builtin sinks include: * pretty-printed console (colors, easy to read) * Graylog2-style JSON to stderr