CI System | Status |
---|---|
Swift Package Index | |
GitHub Action Status |
WrkstrmLog
is a versatile and flexible logging framework designed for consistent logging across different environments including Linux, Xcode, and macOS terminal. It adapts to various contexts, ensuring that log messages are displayed with consistent formatting regardless of the platform.
- ๐ Adaptive Logging: Seamless logging across Linux, Xcode, and macOS terminal environments.
- ๐ผ Multiple Logging Styles: Choose from print, OSLog, and SwiftLog styles.
- ๐ง Flexible and Customizable: Extend the framework to fit specific logging requirements.
- ๐ Easy Integration: Quick setup with Swift Package Manager.
- macOS
- Linux
To integrate WrkstrmLog
into your project, follow these steps:
Add WrkstrmLog
as a dependency in your Package.swift
file:
dependencies: [
.package(url: "https://github.com/wrkstrm/WrkstrmLog.git", .upToNextMajor(from: "0.0.0"))
]
Include WrkstrmLog
in your target dependencies:
targets: [
.target(name: "YourTarget", dependencies: ["WrkstrmLog"]),
]
Import WrkstrmLog
and start logging with ease:
-
๐ฅ Import the Library:
import WrkstrmLog
-
๐จ Initialize Logger: Create a logger instance with your system and category:
let logger = Log(system: "YourSystem", category: "YourCategory")
-
๐ Log Messages: Use various logging methods like
verbose
,info
,error
, andguard
:logger.verbose("Verbose message") logger.info("Info message") logger.error("Error message") Log.guard("Critical error")
WrkstrmLog
offers high customization capabilities. Extend or modify it to suit your project's needs, and utilize the sample formatters as a foundation for custom implementations.
๐ Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
๐ Distributed under the MIT License. See LICENSE
for more information.
๐ Project Link: https://github.com/wrkstrm/WrkstrmLog
- Developed by github.com/@rismay
Ever felt like your logs are speaking different languages across platforms? You're not alone! ๐
Swift developers face a common nemesis:
#if DEBUG
print("Debug: Entering function") // ๐ Only in debug? What about production?
#endif
// ... ๐๏ธ Your awesome code here ...
if let error = performOperation() {
print("Error occurred: \(error)") // ๐ฑ Errors in production, but where?
}
This approach is like trying to conduct an orchestra with musicians playing from different sheets! ๐ป๐บ๐ฅ
WrkstrmLog steps in as the conductor, bringing harmony to your logging chaos. It's like having a universal translator for your logs! ๐๐ฃ๏ธ
import WrkstrmLog
let log = Log(system: "com.myapp", category: "networking")
func someFunction() {
log.debug("๐ฌ Action! Entering someFunction")
// ๐๏ธ Your symphony of code here
if let error = performOperation() {
log.error("๐จ Plot twist! Operation failed: \(error)")
}
log.debug("๐ญ Scene end. Exiting someFunction")
}
- ๐ฏ Unified Interface: One log to rule them all!
- ๐ Flexible Configuration: Dress your logs for any occasion.
- ๐ท๏ธ Smart Categorization: Find that needle in the haystack.
- ๐ Multi-Style Output: Console, Apple's Unified Logging, Swift Logging - we speak them all!
- ๐ Cross-Platform Consistency: From Xcode to Linux, we've got you covered.
- ๐งฉ Extensibility: Build your own log empire!
Add this line to your Package.swift
and let the magic begin:
dependencies: [
.package(url: "https://github.com/wrkstrm/WrkstrmLog.git", .upToNextMajor(from: "1.0.0"))
]
import WrkstrmLog
let log = Log.shared
log.info("๐ App launched! Time to rock and roll!")
WrkstrmLog is like a Swiss Army knife for logging. Here's a taste of its power:
Environment | WrkstrmLog Magic | Default Swift (Boring) Logging |
---|---|---|
Xcode | ๐ Uses .os style. Debug console becomes your crystal ball. |
Basic print() and os.Logger in console. |
macOS Terminal | ๐จ๏ธ .print style. Logs pop right into stdout. |
print() works, os.Logger plays hide and seek. |
Linux | ๐ง .swift style. Bridging the gap like a boss. |
print() only. os.Logger goes MIA. |
We've turbocharged WrkstrmLog:
- ๐ง Lazy evaluation: Logs think before they speak.
- ๐ฆ Efficient filtering: Only the VIP logs get through.
WrkstrmLog isn't just a logger; it's your ticket to logging nirvana. ๐งโโ๏ธ Say goodbye to platform-specific headaches and hello to logging bliss!
Stay tuned for our next episode: "WrkstrmLog Advanced: Turning Your Logs into Superheroes!" ๐ฆธโโ๏ธ๐
For more mind-blowing details, swing by our GitHub repo or dive deep into our docs. Happy logging! ๐๐ง