Reference > API > Logger
Logger
Logger abstraction for server-side logging
WHAT YOU'LL LEARN
- What is exported from
webiny/api/logger? - How to import and use each exported item?
Overview
This page documents everything exported from webiny/api/logger. Import any of the items below directly from this path in your Webiny extensions.
Logger
Abstraction — imported from webiny/api/logger
Interface Logger.Interface:
| Method | Description |
|---|---|
trace() | Log a trace-level message with optional additional arguments. |
debug() | Log a debug-level message with optional additional arguments. |
info() | Log an info-level message with optional additional arguments. |
warn() | Log a warning-level message with optional additional arguments. |
error() | Log an error-level message with optional additional arguments. |
fatal() | Log a fatal-level message with optional additional arguments. |
log() | Log a generic message (defaults to info level) with optional additional arguments. |
Types:
Examples
Basic Usage
Simple logger injection and usage:
Logging Errors
Logging error messages when something goes wrong: