Günlük Çıktı Yöntemleri
Varsayılan AIBuds günlükleyicinin kullanacağı en düşük günlük düzeyini ve tek çıktı hedefini seçin.
API Reference
Framework
AIBudsLog.xcframework
Declaration
- Swift
- Objective-C
/// The current log configuration.
static var logConfiguration: LogConfiguration { get }
/// Configures log storage, rotation, and output behavior.
final class LogConfiguration: NSObject {
/// The severity threshold. Defaults to `.info`.
var level: LogLevel
/// The active output destination. Defaults to `.xlfacility`.
var destination: LogDestination
/// Relative log directory under Documents. Defaults to `.aibuds/logs`.
var logsDirectory: String
/// Maximum single file size. Defaults to 10 MB.
var maxFileSize: UInt64
/// Maximum retained age in days. Defaults to 3.
var logFileMaxAge: Int
}/// The current log configuration.
@property(nonatomic, class, readonly, strong) AIBudsLogConfiguration *logConfiguration;
/// Configures log storage, rotation, and output behavior.
@interface AIBudsLogConfiguration : NSObject
/// The severity threshold. Defaults to `AIBudsLogLevelInfo`.
@property(nonatomic) AIBudsLogLevel level;
/// The active output destination. Defaults to XLFacility.
@property(nonatomic) AIBudsLogDestination destination;
/// Relative log directory under Documents. Defaults to `.aibuds/logs`.
@property(nonatomic, copy) NSString *logsDirectory;
/// Maximum single file size. Defaults to 10 MB.
@property(nonatomic) uint64_t maxFileSize;
/// Maximum retained age in days. Defaults to 3.
@property(nonatomic) NSInteger logFileMaxAge;
@endlogConfiguration, LogLevel ve LogDestination başvurularına bakın.
Günlük Düzeyleri
level, kaydedilecek en düşük önem düzeyidir. Altındaki düzeyler atılır.
| Düzey | Kullanım |
|---|---|
.verbose | Ayrıntılı yürütme izleme. |
.debug | Geliştirme tanılaması. |
.info | Olağan ilerleme ve işletim bilgileri. |
.warn | Dikkat gerektirebilecek durum. |
.error | Uygulamanın çalışmayı sürdürebildiği hata. |
.fatal | Uygulamayı sonlandırabilecek kritik hata. |
.mute | Tüm günlük çıktısını devre dışı bırakır. |
Çıktı Hedefleri
| Hedef | Çıktı | Dışa aktarma |
|---|---|---|
.console | Xcode hata ayıklama konsolu | Hayır |
.oslogger | os_log üzerinden Apple birleşik günlükleme | Hayır |
.file | Yapılandırılan Documents göreli dizinindeki dosyalar | Evet |
.xlfacility | AIBudsXLFacility kalıcılık eklentisi | Eklenti kuruluysa evet |
Kullanım Örnekleri
- Swift
- Objective-C
import AIBudsLog
import AIBudsXLFacility
let configuration = AIBudsLogSDK.logConfiguration
configuration.level = .debug
configuration.destination = .xlfacility
configuration.logFileMaxAge = 7
AIBudsLogSDK.setXLFacilityPlugin(XLFacilitySDK.shared)
AIBudsLogSDK.logService.info(
"SDK configured",
subsystem: "com.example.app",
category: "startup"
)#import <AIBudsLog/AIBudsLog-Swift.h>
#import <AIBudsXLFacility/AIBudsXLFacility-Swift.h>
AIBudsLogConfiguration *configuration = AIBudsLogSDK.logConfiguration;
configuration.level = AIBudsLogLevelDebug;
configuration.destination = AIBudsLogDestinationXlfacility;
configuration.logFileMaxAge = 7;
[AIBudsLogSDK setXLFacilityPlugin:AIBudsXLFacilitySDK.shared];
[AIBudsLogSDK.logService info:@"SDK configured" subsystem:@"com.example.app" category:@"startup"];Notlar
- Hedef seçimi süreç genelindedir ve önceki hedefin yerini alır; aynı anda etkin çıktı kümesi değildir.
logsDirectory, Documents'a göre bir yol kabul eder. Baştaki eğik çizgi SDK tarafından kaldırılır.maxFileSizevelogFileMaxAgeiçin sıfıra eşit veya küçük değerler yok sayılır.- Genel SDK, uzak sunucu günlükleme yapılandırması veya kategori etkinleştirme/devre dışı bırakma anahtarları sunmaz.