-
Notifications
You must be signed in to change notification settings - Fork 114
Logging
The Logger class lets you print information, warning, and other messages to the console output.
You can also replace Zetta logging with a custom logger such as bunyan or winston. See (TBD).
Prints a standard blue log message to the console output.
Arguments
- message - (string) A message to print to the console output.
- data - (object) Relevant data associated with the log message.
server.info('Hello world', { 'hello': 'world' });
Prints a standard yellow log message to the console output.
Arguments
- message - (string) A message to print to the console output.
- data - (object) Relevant data associated with the log message.
server.warn('Hello world', { 'hello': 'world' });
Prints a standard red log message to the console output.
Arguments
- message - (string) A message to print to the console output.
- data - (object) Relevant data associated with the log message.
server.error('Hello world', { 'hello': 'world' });
Same as info()
. Prints a standard blue log message to the console output.
Arguments
- message - (string) A message to print to the console output.
- data - (object) Relevant data associated with the log message.
server.log('Hello world', { 'hello': 'world' });
You can use Logger in devices, scouts, and apps. Below are examples on how to access logging from these different types of files.
Logging in device files
MyDevice.prototype.init = function(config) {
this.info('some info message', { hello: 'world'});
};
Logging in app files
module.exports = function(server) {
server.info('some info message', { hello: 'world'});
};
Logging in scout files
MyScout.prototype.init = function(next) {
this.server.info('some info message', { hello: 'world'});
};
Need help? Visit the Zetta Discuss List !
Need help? Visit the Zetta Discuss List ! |
---|
About Zetta
Videos and webcasts
- NEW! Building with Zetta
Tutorials
- NEW! Zetta tutorial series
- Quick start
- Configure a simple device
- Build a mock LED device
- Use the browser client
- Deploy a Zetta server to Heroku
Understanding Zetta
Writing Zetta drivers
- Finding Zetta device drivers
- Create a device driver from starter code
- More coming soon...
Using streams
Reference