Skip to content

Swift helper for CocoaLumberjack. Maintain global/local loglevels.

License

Notifications You must be signed in to change notification settings

HHuckebein/LogManagement

Repository files navigation

LogManagement

Swift helper for CocoaLumberjack. Maintain global/local loglevels.

Provides

  • a wrapper implementation to hide CocoaLumberjack usage
  • maintains a global log level settings dictionary
  • provides methods to set a different log level certain types

Set a global log level

    InitializeLogging(withLogLevel: .warning)

Enable different level

LogManager.registerLogLevel(forClassNames: [String(describing: SubClassA.self): .debug,
                                            String(describing: SubClassB.self): .info,
                                            String(describing: SomeStruct.self): .verbose])

Usage examples

// MARK: - Class Type

class BaseClass: LogLevel {}

class SubClassA: BaseClass {
    func sampleFunction() {
        LogDebug(logText: "\(self)", level: logLevel)
    }
}

class SubClassB: BaseClass {
    func sampleFunction() {
        LogInfo(logText: "\(self)", level: logLevel)
    }
}

class SubClassC: BaseClass {
    func sampleFunction() {
        LogInfo(logText: "\(self)", level: logLevel)
    }
}

// MARK: - Struct's

struct SomeStruct: LogLevel {
    func sampleFunction() {
        LogVerbose(logText: "\(self)", level: logLevel)
    }
}

// MARK: - Enum's

enum SomeEnum: LogLevel {
    case one
    case two

    func status() {
        LogWarn(logText: "\(self)", level: logLevel)
    }
}

License

  • See the LICENSE file for license rights and limitations (MIT).

About

Swift helper for CocoaLumberjack. Maintain global/local loglevels.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published