2022-11-16 16:41:02 -05:00
|
|
|
//
|
|
|
|
|
// OSLog+SideStore.swift
|
|
|
|
|
// SideStore
|
|
|
|
|
//
|
|
|
|
|
// Created by Joseph Mattiello on 11/16/22.
|
2022-11-16 16:52:36 -05:00
|
|
|
// Copyright © 2022 SideStore. All rights reserved.
|
2022-11-16 16:41:02 -05:00
|
|
|
//
|
|
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
import OSLog
|
|
|
|
|
|
2023-01-04 09:31:51 -05:00
|
|
|
public let customLog = OSLog(subsystem: "org.sidestore.sidestore",
|
2022-11-16 17:50:57 -05:00
|
|
|
category: "ios")
|
2022-11-16 16:41:02 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
public extension OSLog {
|
|
|
|
|
/// Error logger extension
|
|
|
|
|
/// - Parameters:
|
|
|
|
|
/// - message: String or format string
|
|
|
|
|
/// - args: optional args for format string
|
2023-01-04 09:31:51 -05:00
|
|
|
@inlinable
|
2022-11-16 16:41:02 -05:00
|
|
|
static func error(_ message: StaticString, _ args: CVarArg...) {
|
|
|
|
|
os_log(message, log: customLog, type: .error, args)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Info logger extension
|
|
|
|
|
/// - Parameters:
|
|
|
|
|
/// - message: String or format string
|
|
|
|
|
/// - args: optional args for format string
|
2023-01-04 09:31:51 -05:00
|
|
|
@inlinable
|
2022-11-16 16:41:02 -05:00
|
|
|
static func info(_ message: StaticString, _ args: CVarArg...) {
|
|
|
|
|
os_log(message, log: customLog, type: .info, args)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Debug logger extension
|
|
|
|
|
/// - Parameters:
|
|
|
|
|
/// - message: String or format string
|
|
|
|
|
/// - args: optional args for format string
|
2023-01-04 09:31:51 -05:00
|
|
|
@inlinable
|
2022-11-16 16:41:02 -05:00
|
|
|
static func debug(_ message: StaticString, _ args: CVarArg...) {
|
|
|
|
|
os_log(message, log: customLog, type: .debug, args)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-16 17:50:57 -05:00
|
|
|
// TODO: Add file,line,function to messages? -- @JoeMatt
|
|
|
|
|
|
2022-11-16 16:41:02 -05:00
|
|
|
/// Error logger convenience method for SideStore logging
|
|
|
|
|
/// - Parameters:
|
|
|
|
|
/// - message: String or format string
|
|
|
|
|
/// - args: optional args for format string
|
2023-01-04 09:31:51 -05:00
|
|
|
@inlinable
|
2022-11-16 17:50:57 -05:00
|
|
|
public func ELOG(_ message: StaticString, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, _ args: CVarArg...) {
|
2022-11-16 16:41:02 -05:00
|
|
|
OSLog.error(message, args)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Info logger convenience method for SideStore logging
|
|
|
|
|
/// - Parameters:
|
|
|
|
|
/// - message: String or format string
|
|
|
|
|
/// - args: optional args for format string
|
2023-01-04 09:31:51 -05:00
|
|
|
@inlinable
|
2022-11-16 17:50:57 -05:00
|
|
|
public func ILOG(_ message: StaticString, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, _ args: CVarArg...) {
|
2022-11-16 16:41:02 -05:00
|
|
|
OSLog.info(message, args)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Debug logger convenience method for SideStore logging
|
|
|
|
|
/// - Parameters:
|
|
|
|
|
/// - message: String or format string
|
|
|
|
|
/// - args: optional args for format string
|
2022-11-16 17:50:57 -05:00
|
|
|
@inlinable
|
|
|
|
|
public func DLOG(_ message: StaticString, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, _ args: CVarArg...) {
|
2022-11-16 16:41:02 -05:00
|
|
|
OSLog.debug(message, args)
|
|
|
|
|
}
|
2022-11-16 17:50:57 -05:00
|
|
|
|
|
|
|
|
// mark: Helpers
|