-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
4 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 2 additions & 75 deletions
77
PlantUMLFramework/Sources/PlantUMLFramework/Logging/Logger.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,5 @@ | ||
import Foundation | ||
import OSLog | ||
|
||
/// A log level can be used to make logging conditional, e.g. only errors with log level `error` but log infos, warning and errors with log level `info` | ||
public enum LogLevel: Comparable { | ||
/// error | ||
case error | ||
/// warning | ||
case warning | ||
/// info | ||
case info | ||
/// debug | ||
case debug | ||
} | ||
public let logger = Logger(subsystem: "org.bsc.PlantUML", category: "main") | ||
|
||
/// common interface for Loggers | ||
public protocol Logging { | ||
/// log an error | ||
/// - Parameters: | ||
/// - message: to be logged | ||
/// - file: in which the message occurred | ||
/// - function: in wich the message occurred | ||
/// - line: line number in which the message occurred | ||
/// - Parameter message: to be logged | ||
func error(_ message: String, _ file: String, _ function: String, _ line: Int) | ||
|
||
/// log a warning | ||
/// - Parameters: | ||
/// - message: to be logged | ||
/// - file: in which the message occurred | ||
/// - function: in wich the message occurred | ||
/// - line: line number in which the message occurred | ||
func warning(_ message: String, _ file: String, _ function: String, _ line: Int) | ||
|
||
/// log an info | ||
/// - Parameters: | ||
/// - message: to be logged | ||
/// - file: in which the message occurred | ||
/// - function: in wich the message occurred | ||
/// - line: line number in which the message occurred | ||
func info(_ message: String, _ file: String, _ function: String, _ line: Int) | ||
|
||
/// log debugging-related info | ||
/// - Parameters: | ||
/// - message: to be logged | ||
/// - file: in which the message occurred | ||
/// - function: in wich the message occurred | ||
/// - line: line number in which the message occurred | ||
func debug(_ message: String, _ file: String, _ function: String, _ line: Int) | ||
} | ||
|
||
/// :nodoc: | ||
public extension Logging { | ||
/// :nodoc: | ||
func error(_ message: String, _ file: String = #file, _ function: String = #function, _ line: Int = #line) { | ||
error(message, file, function, line) | ||
} | ||
|
||
/// :nodoc: | ||
func warning(_ message: String, _ file: String = #file, _ function: String = #function, _ line: Int = #line) { | ||
warning(message, file, function, line) | ||
} | ||
|
||
/// :nodoc: | ||
func info(_ message: String, _ file: String = #file, _ function: String = #function, _ line: Int = #line) { | ||
info(message, file, function, line) | ||
} | ||
|
||
/// :nodoc: | ||
func debug(_ message: String, _ file: String = #file, _ function: String = #function, _ line: Int = #line) { | ||
debug(message, file, function, line) | ||
} | ||
} | ||
|
||
/// :nodoc: | ||
public enum Logger { | ||
/// singleton to access logger througout the SwiftPlantUMLFramework | ||
public static var shared: Logging = NoLogger() | ||
} |
19 changes: 0 additions & 19 deletions
19
PlantUMLFramework/Sources/PlantUMLFramework/Logging/NoLogger.swift
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters