hubot-ibmcloud-logger
v0.0.20
Published
Logging utility for IBM Cloud hubot scripts
Downloads
10
Readme
hubot-ibmcloud-logger
Logging utility for IBM Cloud hubot scripts
Getting Started
Usage
This script intercepts calls to robot.logger
to add more detailed information about the state of the bot when the logging method was invoked. No changes are required, and one can continue to make calls to the logging functions as one normally would.
Installation
npm install -S hubot-ibmcloud-logger
Add "hubot-ibmcloud-logger"
to the array in external-scripts.json
.
Logging
Hubot uses the environment variable HUBOT_LOG_LEVEL
to control the bots logging level. Invoking the robot logger functionality will add detailed information about the bot state.
Usage
var path = require('path');
var TAG = path.basename(__filename);
robot.logger.debug(`${TAG}: A debug test`);
robot.logger.info(`${TAG}: An info test`);
robot.logger.warning(`${TAG}: A warning test`);
robot.logger.error(`${TAG}: An error test`);
Output
[Tue Jun 28 2016 20:44:12 GMT-0400 (EDT)] DEBUG script.js: A debug test, Adapter: slack, Robot: hubot, Room: secret-channel, User: {name: 'Mimiron'}
[Tue Jun 28 2016 20:44:12 GMT-0400 (EDT)] INFO script.js: An info test, Adapter: slack, Robot: hubot, Room: secret-channel, User: {name: 'Mimiron'}
[Tue Jun 28 2016 20:44:12 GMT-0400 (EDT)] WARNING script.js: A warning test, Adapter: slack, Robot: hubot, Room: secret-channel, User: {name: 'Mimiron'}
[Tue Jun 28 2016 20:44:12 GMT-0400 (EDT)] ERROR script.js: An error test, Adapter: slack, Robot: hubot, Room: secret-channel, User: {name: 'Mimiron'}
License
See LICENSE.txt for license information.
Contribute
Please check out our Contribution Guidelines for detailed information on how you can lend a hand.