LogManager is a simple library to make it easier to add pretty debugging logging entries to an App project.
If you find LogManager
useful and would like to help support its continued development and maintenance, please consider making a small donation, especially if you are using it in a commercial product:
It's through the support of contributors like yourself, I can continue to build, release and maintain high-quality, well documented Swift Packages like LogManager
for free.
Swift Package Manager (Xcode 11 and above)
- In Xcode, select the File > Add Package Dependency… menu item.
- Paste
https://github.com/Appracatappra/LogManager.git
in the dialog box. - Follow the Xcode's instruction to complete the installation.
Why not CocoaPods, or Carthage, or etc?
Supporting multiple dependency managers makes maintaining a library exponentially more complicated and time consuming.
Since, the Swift Package Manager is integrated with Xcode 11 (and greater), it's the easiest choice to support going further.
The library is broken into two main parts:
Debug
- Use the static Debug class when you only want the comments to be printed when the app is compiled for Debug.Log
- Use the static Log class when you want the comments to be printed for both the Debug and Release versions of the app.
Both Debug
and Log
include the same set of functions: log
, info
, error
and notice
.
static func log(_ message:String, suppressDuplicates:Bool = true)
Creates a simple log entry and optionally suppresses duplicate entries.
static func info(subsystem:String, category:String, _ message:String)
Writes an Info message to the log with an optional subsystem
and category
used to identify and group log entries.
static func error(subsystem:String, category:String, _ message:String)
Writes an Error message to the log with an optional subsystem
and category
used to identify and group log entries.
static func notice(subsystem:String, category:String, _ message:String)
Writes an Notice message to the log with an optional subsystem
and category
used to identify and group log entries.
The Package includes full DocC Documentation for all features.