-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathLogging.swift
29 lines (24 loc) · 1.07 KB
/
Logging.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//
// Logging.swift
// TidepoolKit Example
//
// Created by Darin Krauss on 1/17/20.
// Copyright © 2020 Tidepool Project. All rights reserved.
//
import os.log
import TidepoolKit
import Foundation
class Logging: TLogging {
func debug(_ message: String, function: StaticString, file: StaticString, line: UInt) {
os_log("DEBUG: %{public}@ %{public}@", type: .debug, message, location(function: function, file: file, line: line))
}
func info(_ message: String, function: StaticString, file: StaticString, line: UInt) {
os_log("INFO: %{public}@ %{public}@", type: .info, message, location(function: function, file: file, line: line))
}
func error(_ message: String, function: StaticString, file: StaticString, line: UInt) {
os_log("ERROR: %{public}@ %{public}@", type: .error, message, location(function: function, file: file, line: line))
}
private func location(function: StaticString, file: StaticString, line: UInt) -> String {
return "[\(URL(fileURLWithPath: file.description).lastPathComponent):\(line):\(function)]"
}
}