https://github.com/romansky/logr
Its such a simple logger, we had to shorten its name
https://github.com/romansky/logr
Last synced: about 1 month ago
JSON representation
Its such a simple logger, we had to shorten its name
- Host: GitHub
- URL: https://github.com/romansky/logr
- Owner: romansky
- Created: 2012-09-03T12:20:05.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2014-05-10T07:40:48.000Z (about 12 years ago)
- Last Synced: 2025-09-15T10:59:45.862Z (9 months ago)
- Language: CoffeeScript
- Size: 199 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
logr
====
Its such a simple logger, we had to shorten its name
## Installation
npm install node-logr
## Usage
when requiring "logr" you can pass the "__filename" magic parameter and it will magically use the file name, you can pass it any other string that does not contain a forward slash
var logr = require('node-logr').getLogger(__filename)
print some useful things
logr.info("this is a normal thing that happened")
test.js :: 2012-09-03 16:0:18.476 :: INFO :: this is a normal thing that happened
logr.notice("this should not normally happen")
test.js :: 2012-09-03 16:0:51.909 :: NOTICE :: this should not normally happen
print error messages with exceptions
try {
iDontExist()
} catch (e){
logr.error("was expecting this error", e);
}
test.js :: 2012-9-3 16:23:51.463 :: ERROR :: was expecting this error
ReferenceError: iDontExist is not defined
add debug prints which are enable with a global flag
logr.debug("this is a ghost debug message");
require('node-logr').toggleDebug();
logr.debug("this is a debug message");
test.js :: 2012-09-03 16:23:51.465 :: DEBUG :: this is a debug message