hibearnate-logger v1.0.6
hiBEARnate-logger
###hiBEARnate-logger is a supporting package for the hiBEARnate server.
For more information on hiBEARnate, you can find us on seriousbears.net or #seriousbears on quakenet.
To install:
npm install hibearnate-logger
To use the console logger:
var logger = require('hibearnate-logger');
logger.log('some text!');
hiBEARnate-logger will output a line to your console with a timestamp:
2015-09-19 17:52:00 some text!
If you want to log information specific to a route, you can use the logRoute method. You must pass the request object, and it's best to specify a new property of the request object titled route (or we'll write "UNKNOWN" for you).
request.route = 'OnAir'; logger.routeLog(request, 'Starting');
Would yield:
2015-09-19 17:52:00 GET OnAir: Starting
hiBEARnate-logger also provides a logging middleware:
app.use(logger.logRequest)
Each request to the system will generate a log on the console with the following information:
- Timestamp
- Request Method (GET, PUT, etc.)
- Request Source IP
- Request path (/api/something/else)
2015-09-19 17:52:00 Main: Incoming GET request from 192.168.1.1 to /api/request
####Changelog: v1.0.6 (2015-09-22)
- Fixed some issues with this README.md file
- Added proper license to package.json
- Tracked the LICENSE.txt file
v1.0.5 (2015-09-19)
- Rearranged the order that variables from the request are logged when calling routeLog (and updated usage to actually reflect the method name)
v1.0.4 (2015-09-19)
- It helps when you actually export the function you need to use!
v1.0.3 (2015-09-19)
- Updates to package.json
v1.0.2 (2015-09-19)
- Attempting to resolve an issue where the module cannot be found by renaming the js file.
v1.0.1 (2015-09-19)
- Added a routeLog method to log info specific to messages in routes. Speculating that eventually each request will get a unique ID, logging this would be added to this method.
v1.0.0 (2015-09-19)
Broke logging out into a separate module installable with npm. This is an attempt to get the whole of hiBEARnate to be a little easier to maintain!