Logging
A Logging API for Swift.
import Logging
Module information
- Declarations
- 100
- Symbols
- 124
Getting Started
If you have a server-side Swift application, or maybe a cross-platform (for example Linux & macOS) app/library, and you would like to log, we think targeting this logging API package is a great idea. Below you’ll find all you need to know to get started.
Log handler implementations
This package offers the common Logging API as well as a very simple stdout log handler.
In a real system or application, you will want to use one of the many community maintained log handler implementations.
Please refer to the complete list of community maintained logging backend implementations.
Logging API
struct Logger
A
Logger
is the central type inSwiftLog
. Its central function is to emit log messages using one of the methods corresponding to a log level.enum LoggingSystem
The
LoggingSystem
is a global facility where the default logging backend implementation (LogHandler
) can be configured.LoggingSystem
is set up just once in a given program to set up the desired logging backend implementation.
Log Handlers
protocol LogHandler
A
LogHandler
is an implementation of a logging backend.struct MultiplexLogHandler
A pseudo-
LogHandler
that can be used to send messages to multiple otherLogHandler
s.struct StreamLogHandler
StreamLogHandler
is a simple implementation ofLogHandler
for directingLogger
output to eitherstderr
orstdout
via the factory methods.struct SwiftLogNoOpLogHandler
No operation LogHandler, used when no logging is required