Skip to content

andylindebros/Logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logger

Provides a logger for your Swift project

Install

Add Logger as a Swift package dependency

https://github.com/lindebrothers/Logger

How to use it

Methods

public func publish(message: String, obj: Any, level: LogLevel)

Convenient methods

Debug

public func debug(_ obj: Any, functionName: String? = #function, line: Int? = #line, path: String? = #file)

Info

public func info(_ obj: Any, functionName: String? = #function, line: Int? = #line, path: String? = #file)

Warning

public func warning(_ obj: Any, functionName: String? = #function, line: Int? = #line, path: String? = #file)

Error

public func error(_ obj: Any, functionName: String? = #function, line: Int? = #line, path: String? = #file)

Log from a SwiftUI View

struct ContentView: View {
    var body: some View {
        Logger.InView("my message")
    }
}

or use the log modifier

struct ContentView: View {
    var body: some View {
        Color.log("My message")
    }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages