Log Level
Logry supports seven log levels, ordered from most critical to most verbose:
| Level | Description | |
|---|---|---|
fatal | β | Logs critical system failures. The application may crash or exit immediately |
error | β | Logs runtime errors that should be investigated and typically require action |
warn | β οΈ | Logs recoverable issues or unexpected behaviors that don't prevent operation |
info | βΉοΈ | Logs general operational messages, such as successful startups or actions |
debug | π οΈ | Logs detailed internal information helpful for debugging |
trace | π | Logs the most granular details, every step, useful for profiling or deep debugging |
silent | π€ | Disables all logging output |
The logger only outputs messages at or above the current level.
For example, if the level is set to warn, only warn, error, and fatal logs will be printed.
Setting the Desired Log Levelβ
Core-level configs like level are only applied when creating a new core.
If a core with the same ID exists, those configs will be ignored, and a warning will be logged.
// Initialize a logger with a preferred level
const logger = logry({ id: "my-app", level: "debug" });
Forcing Logs Beyond the Level Filterβ
Normally, the logger will only output messages at or above the configured level.
However, you can force a log to be emitted regardless of the current level:
logger.force.error("Something went wrong!");
logger.force.info("This will show even if level is set to 'warn'");
β οΈ Use this with careβ
forceis designed for exceptional situations where logs must be guaranteed to appear.