Levels
Flare uses the standard syslog severity levels for logs. Each level has its own method on flare.logger. The following levels are available, from most to least severe:
| Method | Description |
|---|---|
flare.logger.emergency(message, attributes?) |
System is unusable |
flare.logger.alert(message, attributes?) |
Action must be taken immediately |
flare.logger.critical(message, attributes?) |
Critical conditions |
flare.logger.error(message, attributes?) |
Error conditions |
flare.logger.warning(message, attributes?) |
Warning conditions |
flare.logger.notice(message, attributes?) |
Normal but significant condition |
flare.logger.info(message, attributes?) |
Informational messages |
flare.logger.debug(message, attributes?) |
Debug-level messages |
flare.logger.debug('Cache miss', { key: 'user:42' });
flare.logger.warning('Retrying request', { attempt: 2 });
flare.logger.critical('Payment provider unreachable');
Setting a minimum level
By default, every level is sent to Flare. Set minimumLogLevel to drop anything below a given severity:
flare.configure({
enableLogs: true,
minimumLogLevel: 'warning',
});
With the example above, only logs at warning or above (warning, error, critical, alert, emergency) are recorded. Calls to flare.logger.info() and flare.logger.debug() become no-ops.
Logs filtered out by minimumLogLevel are never buffered, so they cost nothing beyond the method call.
- On this page
- Setting a minimum level