You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

44 lines
1.4 KiB

/**
* DailyNotificationLogger.swift
* Daily Notification Plugin for Capacitor
*
* Provides logging functionality for the notification plugin
*/
import Foundation
/// Logger utility for the DailyNotification plugin
///
/// Provides structured logging capabilities with different severity levels
/// and automatic file/line/function information.
public class DailyNotificationLogger {
/// Shared instance for singleton access
public static let shared = DailyNotificationLogger()
/// Available logging levels
public enum Level: String {
case debug, info, warning, error
}
private init() {}
/// Log a message with the specified severity level
/// - Parameters:
/// - level: The severity level of the log
/// - message: The message to log
/// - file: The file where the log was called (automatic)
/// - function: The function where the log was called (automatic)
/// - line: The line number where the log was called (automatic)
public func log(
_ level: Level,
_ message: String,
file: String = #file,
function: String = #function,
line: Int = #line
) {
#if DEBUG
let fileName = (file as NSString).lastPathComponent
print("[\(level.rawValue.uppercased())] [\(fileName):\(line)] \(function): \(message)")
#endif
}
}