You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repository contains a logging API implementation for Swift.
SwiftLog provides a unified, performant, and ergonomic logging API that can be
adopted by libraries and applications across the Swift ecosystem.
πͺͺ License is Apache 2.0, repeated in LICENSE.txt
π Security issues should be reported via the process in SECURITY.md
π Available Logging Backends: SwiftLog is an API package - you'll want to
choose from the many
community-maintained logging backends for production use
Quick Start
The following snippet shows how to add SwiftLog to your Swift Package:
import Logging
// Create a logger
letlogger=Logger(label:"com.example.YourApp")
// Log at different levels
logger.info("Application started")
logger.warning("This is a warning")
logger.error("Something went wrong", metadata:["error":"\(error)"])
// Add metadata for context
varrequestLogger= logger
requestLogger[metadataKey:"request-id"]="\(UUID())"
requestLogger.info("Processing request")
Available log handler backends
The community has built numerous specialized logging backends.
A great way to discover available log backend implementations is searching the
Swift Package Index
for the swift-log keyword.