Skip to content

Commit

Permalink
Change path to file id. Fixed for some cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanvorobei committed May 9, 2021
1 parent 30140f9 commit 99a3f8b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Sources/SparrowKit/os/SPLogger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@ public enum SPLogger {
// Adding filename if need.
switch Configurator.shared.fileNameMode {
case .show:
// guard let fileName = URL(string: filePath)?.lastPathComponent else { break }
formattedMessage += " [\(filePath)]"
if let fileName = URL(string: filePath)?.lastPathComponent {
formattedMessage += " [\(fileName)]"
} else {
formattedMessage += " [\(filePath)]"
}
case .hide:
break
}
Expand Down Expand Up @@ -153,14 +156,14 @@ public enum SPLogger {
/**
Logging message of level `error` via `SPLogger` system.
*/
public func error(_ message: SPLogger.LogMessage, filePath: String = #filePath) {
public func error(_ message: SPLogger.LogMessage, filePath: String = #fileID) {
SPLogger.log(.error, message: message, filePath: filePath)
}

/**
Logging message of level `debug` via `SPLogger` system.
*/
public func debug(_ message: SPLogger.LogMessage, filePath: String = #filePath) {
public func debug(_ message: SPLogger.LogMessage, filePath: String = #fileID) {
SPLogger.log(.debug, message: message, filePath: filePath)
}
#endif
Binary file not shown.

0 comments on commit 99a3f8b

Please sign in to comment.