-
-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
204 additions
and
121 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
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
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
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
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
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// | ||
// Entry.swift | ||
// | ||
// | ||
// Created by Guilherme Souza on 15/01/24. | ||
// | ||
|
||
import Foundation | ||
|
||
extension SupabaseLogger { | ||
public struct Entry: Codable, CustomStringConvertible { | ||
public let system: String | ||
public let level: Level | ||
public let message: String | ||
public let fileID: String | ||
public let function: String | ||
public let line: UInt | ||
public let timestamp: TimeInterval | ||
|
||
public var description: String { | ||
let date = iso8601Formatter.string(from: Date(timeIntervalSince1970: timestamp)) | ||
let file = fileID.split(separator: ".", maxSplits: 1).first.map(String.init) ?? fileID | ||
return "\(date) [\(level)] [\(system)] [\(file).\(function):\(line)] \(message)" | ||
} | ||
} | ||
} | ||
|
||
private let iso8601Formatter: ISO8601DateFormatter = { | ||
let formatter = ISO8601DateFormatter() | ||
formatter.formatOptions = [.withInternetDateTime] | ||
return formatter | ||
}() |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// Level.swift | ||
// | ||
// | ||
// Created by Guilherme Souza on 15/01/24. | ||
// | ||
|
||
import Foundation | ||
|
||
extension SupabaseLogger { | ||
public enum Level: Int, Codable, CustomStringConvertible, Sendable { | ||
case debug | ||
case warning | ||
case error | ||
|
||
public var description: String { | ||
switch self { | ||
case .debug: | ||
"debug" | ||
case .warning: | ||
"warning" | ||
case .error: | ||
"error" | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.