- Overview
- Installation
- Actions
- Tasks
- Middleware
- Satellites
- Cluster
- Cache
- Chat
- Development Mode
- File System
- Events
- WebSocket
- TCP
- HTTP
- Security
- Validation
- Logging
- Commands
- Testing
Models
- Introduction
- Data Types and Attributes
- Instance and Class Methods
- Validations
- Associations
- Model Configuration
- Queries
Logging
Stellar makes use of the fantastic Winston package for log management. With Winston it is possible to customize log output according to the needs of your project.
Providers
In your config/logger.js
file you can customize which transports
you would like logger to use. If none are provided, a default logger which only will print to stdout will be used. See Winston’s documentation for a list of all logger types; these include console, file, S3, Riak, and more.
'use strict' |
Levels
There are 8 levels of logging; each transport can have a different level. The levels are:
- 0 = debug
- 1 = info
- 2 = notice
- 3 = warning
- 4 = error
- 5 = crit
- 6 = alert
- 7 = emerg
Note: you can customize the levels and colors in the
config/logger.js
file.
For example, if the log level is set to notice, critical messages are visible, but informational and debug messages are not.
// will use the default 'info' level |
Methods
The api.logger.log
and api.logger[severity]
methods are accessible via the api
object and allow you to modify the Winston instance directly. The api.log
method passes the message to all transports. Below are some examples of using the api.log(message, severity, metadata)
method:
// the most basic use - will assume 'info' as the severity |