https://github.com/jishnutu/loggerjs
console log in formal way for complex javascript applications
https://github.com/jishnutu/loggerjs
javascript logger logging npm-package typescript
Last synced: 3 months ago
JSON representation
console log in formal way for complex javascript applications
- Host: GitHub
- URL: https://github.com/jishnutu/loggerjs
- Owner: JishnuTU
- License: mit
- Created: 2018-03-19T12:27:17.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-22T05:54:36.000Z (over 8 years ago)
- Last Synced: 2025-03-05T17:45:03.686Z (over 1 year ago)
- Topics: javascript, logger, logging, npm-package, typescript
- Language: JavaScript
- Size: 14.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# loggerJS
console log in formal way for complex javascript applications
Usage
npm install logger-simple
var LoggerJS = require("logger-simple");
Create a object as global in the js file:
var log_ = new LoggerJS.LoggerJS('#custom profile name');
Now console your message using the functions:
log_.info('#message');
log_.info('#message',#data);
log_.info('#data');
log_.info('#message',#data,'#functionName');
log_.error('#message');
log_.error('#message',#data);
log_.error('#data');
log_.error('#message',#data,'#functionName');
log_.debug('#message');
log_.debug('#message',#data);
log_.debug(#data);
log_.debug('#message',#data,'#functionName')
The message ,function and custom profile name is expected as string.
The data can be anything array,object,...
if used "use strict" then the function name cannot be acquired , you have to provide it as third parameter explictly.
The way the logging is done:
[INFO] [#message]
[2011-10-05T14:48:00.000Z] [#custom profile name : #functionName]
[PAYLOAD] {"sample":"test"}
- - - - - -
[DEBUG] [#message]
[2011-10-05T14:48:00.000Z] [#custom profile name : #functionName]
[PAYLOAD] {"sample":"test"}
- - - - - -
[ERROR] [#message]
[2011-10-05T14:48:00.000Z] [#custom profile name : #functionName]
[PAYLOAD] {"sample":"test"}
- - - - - -