//
//  SDLLogger.swift
//  Tun
//
//  Created by 安礼成 on 2024/3/13.
//
import Foundation
import os

public class SDLLogger: @unchecked Sendable {
    public enum Level: Int8, CustomStringConvertible {
        case debug = 0
        case info = 1
        case warning = 2
        case error = 3
        
        public var description: String {
            switch self {
            case .debug:
                return "Debug"
            case .info:
                return "Info"
            case .warning:
                return "Warning"
            case .error:
                return "Error"
            }
        }
    }
    
    static let shared = SDLLogger(level: .debug)
    
    private let level: Level
    private let log: Logger
    
    private init(level: Level) {
        self.level = level
        self.log = Logger(subsystem: "com.jihe.punchnet", category: "punchnet")
    }
    
    public func log(_ message: String, level: Level = .debug) {
        self.log.info("\(message, privacy: .public)")
    }
    
}
