mirror of
https://github.com/apple/swift-log
synced 2026-11-22 03:40:39 +00:00
4121d24dbd71c363ea6f9e5f4664044b17cfc704
Provide organization (aka curation) and abstracts for all of the public
types in the library.
### Motivation:
Updates to the documentation to fill in the missing abstracts for the
provided types, updating the language to follow Apple developer content
guidelines, and fixing smaller typos and grammar issues.
### Modifications:
Curation files added to provide organization for public types, ordering
the content to align with the narrative content provided earlier.
Updating API comments, adding abstracts and parameters where missing,
and moving some of the getting started content that was previously in
the main index into a separate article.
### Result:
starting point
```
--- Experimental coverage output enabled. ---
| Abstract | Curated | Code Listing
Types | 69% (11/16) | 38% (6/16) | 25% (4/16)
Members | 57% (54/94) | 3.2% (3/94) | 0.0% (0/94)
Globals | 7.1% (1/14) | 7.1% (1/14) | 7.1% (1/14)
```
Updated:
```
| Abstract | Curated | Code Listing
Types | 94% (15/16) | 94% (15/16) | 38% (6/16)
Members | 85% (80/94) | 97% (91/94) | 0.0% (0/94)
Globals | 14% (2/14) | 100% (14/14) | 7.1% (1/14)
```
---------
Co-authored-by: Honza Dvorsky <honza@apple.com>
Co-authored-by: Franz Busch <privat@franz-busch.de>
SwiftLog
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.
- 📚 Documentation and tutorials are available on the Swift Package Index
- 🚀 Contributions are welcome, please see CONTRIBUTING.md
- 🪪 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:
// swift-tools-version: 6.1
import PackageDescription
let package = Package(
name: "YourApp",
dependencies: [
.package(url: "https://github.com/apple/swift-log", from: "1.6.0")
],
targets: [
.target(
name: "YourApp",
dependencies: [
.product(name: "Logging", package: "swift-log")
]
)
]
)
Then start logging:
import Logging
// Create a logger
let logger = 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
var requestLogger = 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.
Description
Mirror of github.com/apple/swift-log
3.3 MiB
0 Stars
1 Watchers
0 Forks
Languages
Swift
97.5%
CMake
2.5%