feat: implement core notification functionality for iOS and Android - Add settings management, proper error handling, and platform-specific implementations
This commit is contained in:
44
ios/Plugin/DailyNotificationLogger.swift
Normal file
44
ios/Plugin/DailyNotificationLogger.swift
Normal file
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* 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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user