diff --git a/KmpLogger.podspec b/KmpLogger.podspec
index 5a5f526..6101ccf 100644
--- a/KmpLogger.podspec
+++ b/KmpLogger.podspec
@@ -1,11 +1,11 @@
Pod::Spec.new do |s|
s.name = 'KmpLogger'
- s.version = '1.1.0-beta'
+ s.version = '1.1.0'
s.summary = 'Kotlin Multiplatform logging library for iOS'
s.homepage = 'https://github.com/Scarlet-Pan/logger'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.authors = { 'Scarlet Pan' => 'scarletpan@qq.com' }
- s.source = { :git => 'https://github.com/Scarlet-Pan/logger.git', :tag => '1.1.0-beta' }
+ s.source = { :git => 'https://github.com/Scarlet-Pan/logger.git', :tag => '1.1.0' }
s.vendored_frameworks = 'KmpLogger.xcframework'
s.ios.deployment_target = '12.0'
s.swift_version = '5.0'
diff --git a/KmpLogger.xcframework/Info.plist b/KmpLogger.xcframework/Info.plist
index 08969a0..973a456 100644
--- a/KmpLogger.xcframework/Info.plist
+++ b/KmpLogger.xcframework/Info.plist
@@ -8,32 +8,32 @@
BinaryPath
KmpLogger.framework/KmpLogger
LibraryIdentifier
- ios-arm64
+ ios-arm64_x86_64-simulator
LibraryPath
KmpLogger.framework
SupportedArchitectures
arm64
+ x86_64
SupportedPlatform
ios
+ SupportedPlatformVariant
+ simulator
BinaryPath
KmpLogger.framework/KmpLogger
LibraryIdentifier
- ios-arm64_x86_64-simulator
+ ios-arm64
LibraryPath
KmpLogger.framework
SupportedArchitectures
arm64
- x86_64
SupportedPlatform
ios
- SupportedPlatformVariant
- simulator
CFBundlePackageType
diff --git a/KmpLogger.xcframework/ios-arm64/KmpLogger.framework/Headers/KmpLogger.h b/KmpLogger.xcframework/ios-arm64/KmpLogger.framework/Headers/KmpLogger.h
index 99d4e40..c079b7c 100644
--- a/KmpLogger.xcframework/ios-arm64/KmpLogger.framework/Headers/KmpLogger.h
+++ b/KmpLogger.xcframework/ios-arm64/KmpLogger.framework/Headers/KmpLogger.h
@@ -6,9 +6,9 @@
#import
#import
-@class KmpLoggerKotlinThrowable, LoggingLevel, KmpLoggerAbsLogger, Logger, KmpLoggerKotlinEnumCompanion, KmpLoggerKotlinEnum, KmpLoggerKotlinArray;
+@class KmpLoggerKotlinThrowable, KmpLoggerLoggerLevel, KmpLoggerAbsLogger, SharedLogger, KmpLoggerKotlinEnumCompanion, KmpLoggerKotlinEnum, KmpLoggerKotlinArray;
-@protocol Logging, KmpLoggerKotlinComparable, KmpLoggerKotlinIterator;
+@protocol KmpLoggerLogger, KmpLoggerKotlinComparable, KmpLoggerKotlinIterator;
NS_ASSUME_NONNULL_BEGIN
#pragma clang diagnostic push
@@ -144,7 +144,8 @@ __attribute__((swift_name("KotlinBoolean")))
+ (instancetype)numberWithBool:(BOOL)value;
@end
-@protocol Logging
+__attribute__((swift_name("Logger")))
+@protocol KmpLoggerLogger
@required
- (void)dTag:(NSString *)tag msg:(NSString *)msg tr:(KmpLoggerKotlinThrowable * _Nullable)tr __attribute__((swift_name("d(tag:msg:tr:)")));
- (void)eTag:(NSString *)tag msg:(NSString *)msg tr:(KmpLoggerKotlinThrowable * _Nullable)tr __attribute__((swift_name("e(tag:msg:tr:)")));
@@ -154,7 +155,7 @@ __attribute__((swift_name("KotlinBoolean")))
@end
__attribute__((swift_name("AbsLogger")))
-@interface KmpLoggerAbsLogger : KmpLoggerBase
+@interface KmpLoggerAbsLogger : KmpLoggerBase
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
- (void)dTag:(NSString *)tag msg:(NSString *)msg tr:(KmpLoggerKotlinThrowable * _Nullable)tr __attribute__((swift_name("d(tag:msg:tr:)")));
@@ -164,35 +165,35 @@ __attribute__((swift_name("AbsLogger")))
/**
* @note This method has protected visibility in Kotlin source and is intended only for use by subclasses.
*/
-- (void)logLevel:(LoggingLevel *)level tag:(NSString *)tag msg:(NSString *)msg tr:(KmpLoggerKotlinThrowable * _Nullable)tr __attribute__((swift_name("log(level:tag:msg:tr:)")));
+- (void)logLevel:(KmpLoggerLoggerLevel *)level tag:(NSString *)tag msg:(NSString *)msg tr:(KmpLoggerKotlinThrowable * _Nullable)tr __attribute__((swift_name("log(level:tag:msg:tr:)")));
- (void)wTag:(NSString *)tag msg:(NSString *)msg tr:(KmpLoggerKotlinThrowable * _Nullable)tr __attribute__((swift_name("w(tag:msg:tr:)")));
@end
__attribute__((objc_subclassing_restricted))
-@interface Logger : KmpLoggerAbsLogger
+@interface SharedLogger : KmpLoggerAbsLogger
+ (instancetype)alloc __attribute__((unavailable));
+ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
+ (instancetype)new __attribute__((unavailable));
-+ (instancetype)logger __attribute__((swift_name("init()")));
-@property (class, readonly, getter=shared) Logger *shared __attribute__((swift_name("shared")));
++ (instancetype)sharedLogger __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) SharedLogger *shared __attribute__((swift_name("shared")));
/**
* @note This method has protected visibility in Kotlin source and is intended only for use by subclasses.
*/
-- (void)logLevel:(LoggingLevel *)level tag:(NSString *)tag msg:(NSString *)msg tr:(KmpLoggerKotlinThrowable * _Nullable)tr __attribute__((swift_name("log(level:tag:msg:tr:)")));
+- (void)logLevel:(KmpLoggerLoggerLevel *)level tag:(NSString *)tag msg:(NSString *)msg tr:(KmpLoggerKotlinThrowable * _Nullable)tr __attribute__((swift_name("log(level:tag:msg:tr:)")));
/**
* @note annotations
* kotlin.jvm.JvmStatic
*/
-@property (readonly) id SYSTEM __attribute__((swift_name("SYSTEM")));
+@property (readonly) id SYSTEM __attribute__((swift_name("SYSTEM")));
/**
* @note annotations
* kotlin.jvm.JvmStatic
*/
-@property (getter=default, setter=setDefault:) id default_ __attribute__((swift_name("default_")));
+@property (getter=default, setter=setDefault:) id default_ __attribute__((swift_name("default_")));
@end
__attribute__((swift_name("KotlinComparable")))
@@ -214,16 +215,17 @@ __attribute__((swift_name("KotlinEnum")))
@end
__attribute__((objc_subclassing_restricted))
-@interface LoggingLevel : KmpLoggerKotlinEnum
+__attribute__((swift_name("LoggerLevel")))
+@interface KmpLoggerLoggerLevel : KmpLoggerKotlinEnum
+ (instancetype)alloc __attribute__((unavailable));
+ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
- (instancetype)initWithName:(NSString *)name ordinal:(int32_t)ordinal __attribute__((swift_name("init(name:ordinal:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
-@property (class, readonly) LoggingLevel *debug __attribute__((swift_name("debug")));
-@property (class, readonly) LoggingLevel *info __attribute__((swift_name("info")));
-@property (class, readonly) LoggingLevel *warn __attribute__((swift_name("warn")));
-@property (class, readonly) LoggingLevel *error __attribute__((swift_name("error")));
-+ (KmpLoggerKotlinArray *)values __attribute__((swift_name("values()")));
-@property (class, readonly) NSArray *entries __attribute__((swift_name("entries")));
+@property (class, readonly) KmpLoggerLoggerLevel *debug __attribute__((swift_name("debug")));
+@property (class, readonly) KmpLoggerLoggerLevel *info __attribute__((swift_name("info")));
+@property (class, readonly) KmpLoggerLoggerLevel *warn __attribute__((swift_name("warn")));
+@property (class, readonly) KmpLoggerLoggerLevel *error __attribute__((swift_name("error")));
++ (KmpLoggerKotlinArray *)values __attribute__((swift_name("values()")));
+@property (class, readonly) NSArray *entries __attribute__((swift_name("entries")));
@end
__attribute__((objc_subclassing_restricted))
@@ -234,7 +236,7 @@ __attribute__((swift_name("CompositeLoggerKt")))
* @note annotations
* kotlin.jvm.JvmName(name="combine")
*/
-+ (id)plus:(id)receiver other:(id)other __attribute__((swift_name("plus(_:other:)")));
++ (id)plus:(id)receiver other:(id)other __attribute__((swift_name("plus(_:other:)")));
@end
__attribute__((objc_subclassing_restricted))
@@ -245,7 +247,7 @@ __attribute__((swift_name("LoggersKt")))
* @note annotations
* kotlin.jvm.JvmOverloads
*/
-+ (void)log:(id)receiver level:(LoggingLevel *)level tag:(NSString *)tag msg:(NSString *)msg tr:(KmpLoggerKotlinThrowable * _Nullable)tr __attribute__((swift_name("log(_:level:tag:msg:tr:)")));
++ (void)log:(id)receiver level:(KmpLoggerLoggerLevel *)level tag:(NSString *)tag msg:(NSString *)msg tr:(KmpLoggerKotlinThrowable * _Nullable)tr __attribute__((swift_name("log(_:level:tag:msg:tr:)")));
@end
__attribute__((swift_name("KotlinThrowable")))
diff --git a/KmpLogger.xcframework/ios-arm64/KmpLogger.framework/KmpLogger b/KmpLogger.xcframework/ios-arm64/KmpLogger.framework/KmpLogger
index 139f211..85c3a79 100755
Binary files a/KmpLogger.xcframework/ios-arm64/KmpLogger.framework/KmpLogger and b/KmpLogger.xcframework/ios-arm64/KmpLogger.framework/KmpLogger differ
diff --git a/KmpLogger.xcframework/ios-arm64_x86_64-simulator/KmpLogger.framework/Headers/KmpLogger.h b/KmpLogger.xcframework/ios-arm64_x86_64-simulator/KmpLogger.framework/Headers/KmpLogger.h
index 99d4e40..c079b7c 100644
--- a/KmpLogger.xcframework/ios-arm64_x86_64-simulator/KmpLogger.framework/Headers/KmpLogger.h
+++ b/KmpLogger.xcframework/ios-arm64_x86_64-simulator/KmpLogger.framework/Headers/KmpLogger.h
@@ -6,9 +6,9 @@
#import
#import
-@class KmpLoggerKotlinThrowable, LoggingLevel, KmpLoggerAbsLogger, Logger, KmpLoggerKotlinEnumCompanion, KmpLoggerKotlinEnum, KmpLoggerKotlinArray;
+@class KmpLoggerKotlinThrowable, KmpLoggerLoggerLevel, KmpLoggerAbsLogger, SharedLogger, KmpLoggerKotlinEnumCompanion, KmpLoggerKotlinEnum, KmpLoggerKotlinArray;
-@protocol Logging, KmpLoggerKotlinComparable, KmpLoggerKotlinIterator;
+@protocol KmpLoggerLogger, KmpLoggerKotlinComparable, KmpLoggerKotlinIterator;
NS_ASSUME_NONNULL_BEGIN
#pragma clang diagnostic push
@@ -144,7 +144,8 @@ __attribute__((swift_name("KotlinBoolean")))
+ (instancetype)numberWithBool:(BOOL)value;
@end
-@protocol Logging
+__attribute__((swift_name("Logger")))
+@protocol KmpLoggerLogger
@required
- (void)dTag:(NSString *)tag msg:(NSString *)msg tr:(KmpLoggerKotlinThrowable * _Nullable)tr __attribute__((swift_name("d(tag:msg:tr:)")));
- (void)eTag:(NSString *)tag msg:(NSString *)msg tr:(KmpLoggerKotlinThrowable * _Nullable)tr __attribute__((swift_name("e(tag:msg:tr:)")));
@@ -154,7 +155,7 @@ __attribute__((swift_name("KotlinBoolean")))
@end
__attribute__((swift_name("AbsLogger")))
-@interface KmpLoggerAbsLogger : KmpLoggerBase
+@interface KmpLoggerAbsLogger : KmpLoggerBase
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
- (void)dTag:(NSString *)tag msg:(NSString *)msg tr:(KmpLoggerKotlinThrowable * _Nullable)tr __attribute__((swift_name("d(tag:msg:tr:)")));
@@ -164,35 +165,35 @@ __attribute__((swift_name("AbsLogger")))
/**
* @note This method has protected visibility in Kotlin source and is intended only for use by subclasses.
*/
-- (void)logLevel:(LoggingLevel *)level tag:(NSString *)tag msg:(NSString *)msg tr:(KmpLoggerKotlinThrowable * _Nullable)tr __attribute__((swift_name("log(level:tag:msg:tr:)")));
+- (void)logLevel:(KmpLoggerLoggerLevel *)level tag:(NSString *)tag msg:(NSString *)msg tr:(KmpLoggerKotlinThrowable * _Nullable)tr __attribute__((swift_name("log(level:tag:msg:tr:)")));
- (void)wTag:(NSString *)tag msg:(NSString *)msg tr:(KmpLoggerKotlinThrowable * _Nullable)tr __attribute__((swift_name("w(tag:msg:tr:)")));
@end
__attribute__((objc_subclassing_restricted))
-@interface Logger : KmpLoggerAbsLogger
+@interface SharedLogger : KmpLoggerAbsLogger
+ (instancetype)alloc __attribute__((unavailable));
+ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
+ (instancetype)new __attribute__((unavailable));
-+ (instancetype)logger __attribute__((swift_name("init()")));
-@property (class, readonly, getter=shared) Logger *shared __attribute__((swift_name("shared")));
++ (instancetype)sharedLogger __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) SharedLogger *shared __attribute__((swift_name("shared")));
/**
* @note This method has protected visibility in Kotlin source and is intended only for use by subclasses.
*/
-- (void)logLevel:(LoggingLevel *)level tag:(NSString *)tag msg:(NSString *)msg tr:(KmpLoggerKotlinThrowable * _Nullable)tr __attribute__((swift_name("log(level:tag:msg:tr:)")));
+- (void)logLevel:(KmpLoggerLoggerLevel *)level tag:(NSString *)tag msg:(NSString *)msg tr:(KmpLoggerKotlinThrowable * _Nullable)tr __attribute__((swift_name("log(level:tag:msg:tr:)")));
/**
* @note annotations
* kotlin.jvm.JvmStatic
*/
-@property (readonly) id SYSTEM __attribute__((swift_name("SYSTEM")));
+@property (readonly) id SYSTEM __attribute__((swift_name("SYSTEM")));
/**
* @note annotations
* kotlin.jvm.JvmStatic
*/
-@property (getter=default, setter=setDefault:) id default_ __attribute__((swift_name("default_")));
+@property (getter=default, setter=setDefault:) id default_ __attribute__((swift_name("default_")));
@end
__attribute__((swift_name("KotlinComparable")))
@@ -214,16 +215,17 @@ __attribute__((swift_name("KotlinEnum")))
@end
__attribute__((objc_subclassing_restricted))
-@interface LoggingLevel : KmpLoggerKotlinEnum
+__attribute__((swift_name("LoggerLevel")))
+@interface KmpLoggerLoggerLevel : KmpLoggerKotlinEnum
+ (instancetype)alloc __attribute__((unavailable));
+ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
- (instancetype)initWithName:(NSString *)name ordinal:(int32_t)ordinal __attribute__((swift_name("init(name:ordinal:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
-@property (class, readonly) LoggingLevel *debug __attribute__((swift_name("debug")));
-@property (class, readonly) LoggingLevel *info __attribute__((swift_name("info")));
-@property (class, readonly) LoggingLevel *warn __attribute__((swift_name("warn")));
-@property (class, readonly) LoggingLevel *error __attribute__((swift_name("error")));
-+ (KmpLoggerKotlinArray *)values __attribute__((swift_name("values()")));
-@property (class, readonly) NSArray *entries __attribute__((swift_name("entries")));
+@property (class, readonly) KmpLoggerLoggerLevel *debug __attribute__((swift_name("debug")));
+@property (class, readonly) KmpLoggerLoggerLevel *info __attribute__((swift_name("info")));
+@property (class, readonly) KmpLoggerLoggerLevel *warn __attribute__((swift_name("warn")));
+@property (class, readonly) KmpLoggerLoggerLevel *error __attribute__((swift_name("error")));
++ (KmpLoggerKotlinArray *)values __attribute__((swift_name("values()")));
+@property (class, readonly) NSArray *entries __attribute__((swift_name("entries")));
@end
__attribute__((objc_subclassing_restricted))
@@ -234,7 +236,7 @@ __attribute__((swift_name("CompositeLoggerKt")))
* @note annotations
* kotlin.jvm.JvmName(name="combine")
*/
-+ (id)plus:(id)receiver other:(id)other __attribute__((swift_name("plus(_:other:)")));
++ (id)plus:(id)receiver other:(id)other __attribute__((swift_name("plus(_:other:)")));
@end
__attribute__((objc_subclassing_restricted))
@@ -245,7 +247,7 @@ __attribute__((swift_name("LoggersKt")))
* @note annotations
* kotlin.jvm.JvmOverloads
*/
-+ (void)log:(id)receiver level:(LoggingLevel *)level tag:(NSString *)tag msg:(NSString *)msg tr:(KmpLoggerKotlinThrowable * _Nullable)tr __attribute__((swift_name("log(_:level:tag:msg:tr:)")));
++ (void)log:(id)receiver level:(KmpLoggerLoggerLevel *)level tag:(NSString *)tag msg:(NSString *)msg tr:(KmpLoggerKotlinThrowable * _Nullable)tr __attribute__((swift_name("log(_:level:tag:msg:tr:)")));
@end
__attribute__((swift_name("KotlinThrowable")))
diff --git a/KmpLogger.xcframework/ios-arm64_x86_64-simulator/KmpLogger.framework/KmpLogger b/KmpLogger.xcframework/ios-arm64_x86_64-simulator/KmpLogger.framework/KmpLogger
index e983667..5a1d5a4 100755
Binary files a/KmpLogger.xcframework/ios-arm64_x86_64-simulator/KmpLogger.framework/KmpLogger and b/KmpLogger.xcframework/ios-arm64_x86_64-simulator/KmpLogger.framework/KmpLogger differ
diff --git a/logger-slf4j/src/main/kotlin/dev/scarlet/logger/slf4j/Slf4jLogger.kt b/logger-slf4j/src/main/kotlin/dev/scarlet/logger/slf4j/Slf4jLogger.kt
index af15651..5251bd2 100644
--- a/logger-slf4j/src/main/kotlin/dev/scarlet/logger/slf4j/Slf4jLogger.kt
+++ b/logger-slf4j/src/main/kotlin/dev/scarlet/logger/slf4j/Slf4jLogger.kt
@@ -20,7 +20,7 @@ import org.slf4j.LoggerFactory
* to be present at runtime. Ensure your project includes an appropriate SLF4J provider.
*
* @author Scarlet Pan
- * @since 1.0.0
+ * @version 1.0.0
*/
object Slf4jLogger : dev.scarlet.logger.Logger {
diff --git a/logger-slf4j/src/test/kotlin/dev/scarlet/logger/slf4j/Slf4jLoggerTest.kt b/logger-slf4j/src/test/kotlin/dev/scarlet/logger/slf4j/Slf4jLoggerTest.kt
index 0b40cca..21f4607 100644
--- a/logger-slf4j/src/test/kotlin/dev/scarlet/logger/slf4j/Slf4jLoggerTest.kt
+++ b/logger-slf4j/src/test/kotlin/dev/scarlet/logger/slf4j/Slf4jLoggerTest.kt
@@ -7,7 +7,7 @@ import kotlin.test.assertEquals
/**
* @author Scarlet Pan
- * @since 1.0.0
+ * @version 1.0.0
*/
class Slf4jLoggerTest {
diff --git a/logger/build.gradle.kts b/logger/build.gradle.kts
index bbf8814..6078259 100644
--- a/logger/build.gradle.kts
+++ b/logger/build.gradle.kts
@@ -8,7 +8,7 @@ plugins {
}
group = "io.github.scarlet-pan"
-version = "1.1.0-beta"
+version = "1.1.0"
val xcfName = "KmpLogger"
diff --git a/logger/src/commonMain/kotlin/dev/scarlet/logger/AbsLogger.kt b/logger/src/commonMain/kotlin/dev/scarlet/logger/AbsLogger.kt
index ff79e00..ffad86a 100644
--- a/logger/src/commonMain/kotlin/dev/scarlet/logger/AbsLogger.kt
+++ b/logger/src/commonMain/kotlin/dev/scarlet/logger/AbsLogger.kt
@@ -1,3 +1,5 @@
+@file:OptIn(ExperimentalObjCName::class)
+
package dev.scarlet.logger
import dev.scarlet.logger.Logger.Level
@@ -5,6 +7,7 @@ import dev.scarlet.logger.Logger.Level.DEBUG
import dev.scarlet.logger.Logger.Level.ERROR
import dev.scarlet.logger.Logger.Level.INFO
import dev.scarlet.logger.Logger.Level.WARN
+import kotlin.experimental.ExperimentalObjCName
/**
* An abstract base implementation of the [Logger] interface that provides default
@@ -27,7 +30,7 @@ import dev.scarlet.logger.Logger.Level.WARN
* ```
*
* @author Scarlet Pan
- * @since 1.0.0
+ * @version 1.0.0
*/
abstract class AbsLogger : Logger {
diff --git a/logger/src/commonMain/kotlin/dev/scarlet/logger/Logger.kt b/logger/src/commonMain/kotlin/dev/scarlet/logger/Logger.kt
index 1ec35f3..33336a3 100644
--- a/logger/src/commonMain/kotlin/dev/scarlet/logger/Logger.kt
+++ b/logger/src/commonMain/kotlin/dev/scarlet/logger/Logger.kt
@@ -32,7 +32,6 @@ import kotlin.native.ObjCName
* @author Scarlet Pan
* @version 1.0.1
*/
-@ObjCName("Logging", exact = true)
interface Logger {
/**
@@ -43,7 +42,7 @@ interface Logger {
* Logger.e("Database", "Failed to open it.", exception)
* ```
*/
- @ObjCName("Logger", exact = true)
+ @ObjCName("SharedLogger", exact = true)
companion object : AbsLogger() {
private const val TAG = "Logger"
@@ -166,7 +165,7 @@ interface Logger {
* ```
*
* @author Scarlet Pan
- * @since 1.0.0
+ * @version 1.0.0
*/
enum class Level {
diff --git a/logger/src/iosMain/swfit/Loggers.swift b/logger/src/iosMain/swfit/Loggers.swift
index 7503b00..fc6c0ba 100644
--- a/logger/src/iosMain/swfit/Loggers.swift
+++ b/logger/src/iosMain/swfit/Loggers.swift
@@ -1,10 +1,8 @@
-// Loggers.swift
-//
// Add this file to your iOS/macOS target to enable static-style logging:
-// Logger.i("Tag", "Message")
+// SharedLogger.i("Tag", "Message")
//
// This file is part of the Scarlet Logger KMP library.
-// https://github.com/scarlet-pan/logger
+// https://github.com/scarlet-pen/logger
//
// MIT License
// Copyright (c) 2025 Scarlet Pan
@@ -18,19 +16,19 @@ import KmpLogger
/// It supports four standard severity levels: DEBUG, INFO, WARN, and ERROR.
///
/// The interface itself contains no implementation — actual behavior is determined by the concrete logger
-/// assigned to ``Logger/default``. By default, logs are printed to standard output (visible in Xcode console).
+/// assigned to ``SharedLogger/default``. By default, logs are printed to standard output (visible in Xcode console).
///
/// All methods are thread-safe and may be called from any thread or async context.
///
/// ### Default Behavior
/// - On iOS/macOS: Messages are formatted and sent to `print()`, appearing in the Xcode console.
-/// - The initial value of ``Logger/default`` is the system-provided logger (`SYSTEM`).
+/// - The initial value of ``SharedLogger/default`` is the system-provided logger (`SYSTEM`).
///
/// ### Customization
/// Replace the global logger to route logs to files, network, third-party services, or apply filtering:
/// ```swift
-/// Logger.default = MyCustomLogger()
-/// Logger.i("App", "Now using custom logger")
+/// SharedLogger.default = MyCustomLogger()
+/// SharedLogger.i("App", "Now using custom logger")
/// ```
///
/// ### Log Levels
@@ -43,15 +41,16 @@ import KmpLogger
///
/// Example:
/// ```swift
-/// Logger.d("Network", "Request body: \(json)")
-/// Logger.i("Auth", "User signed in")
-/// Logger.w("Cache", "Missed entry; fetching from network")
-/// Logger.e("Database", "Failed to open", error: dbError)
+/// SharedLogger.d("Network", "Request body: \(json)")
+/// SharedLogger.i("Auth", "User signed in")
+/// SharedLogger.w("Cache", "Missed entry; fetching from network")
+/// SharedLogger.e("Database", "Failed to open", error: dbError)
/// ```
-extension Logger {
+extension SharedLogger {
+
/// The global default logger instance used by all static logging methods.
///
- /// This property acts as a delegate: every call like `Logger.i(...)` is forwarded to the current value
+ /// This property acts as a delegate: every call like `SharedLogger.i(...)` is forwarded to the current value
/// of this property. Changing it takes effect immediately.
///
/// On assignment, the new logger automatically logs an INFO message:
@@ -61,9 +60,9 @@ extension Logger {
/// This helps diagnose logger pipeline changes at runtime.
///
/// The initial value is the platform-specific system logger (equivalent to `SYSTEM` in Kotlin).
- public static var `default`: Logging {
- get { Logger.shared.default_}
- set { Logger.shared.default_ = newValue }
+ public static var `default`: Logger {
+ get { SharedLogger.shared.default_ }
+ set { SharedLogger.shared.default_ = newValue }
}
/// Logs a message at the **DEBUG** level.
@@ -77,7 +76,7 @@ extension Logger {
/// - message: The log message (must not be nil).
/// - error: An optional error; if provided, its description and stack trace (if available) should be included.
public static func d(_ tag: String, _ message: String, error: Error? = nil) {
- Logger.shared.d(tag: tag, msg: message, tr: error?.asException())
+ SharedLogger.shared.d(tag: tag, msg: message, tr: error?.asException())
}
/// Logs a message at the **INFO** level.
@@ -90,7 +89,7 @@ extension Logger {
/// - message: The log message.
/// - error: An optional error to attach.
public static func i(_ tag: String, _ message: String, error: Error? = nil) {
- Logger.shared.i(tag: tag, msg: message, tr: error?.asException())
+ SharedLogger.shared.i(tag: tag, msg: message, tr: error?.asException())
}
/// Logs a message at the **WARN** level.
@@ -103,7 +102,7 @@ extension Logger {
/// - message: The warning message. Defaults to an empty string if only an error is relevant.
/// - error: An optional error to attach.
public static func w(_ tag: String, _ message: String = "", error: Error? = nil) {
- Logger.shared.w(tag: tag, msg: message, tr: error?.asException())
+ SharedLogger.shared.w(tag: tag, msg: message, tr: error?.asException())
}
/// Logs a message at the **ERROR** level.
@@ -116,8 +115,9 @@ extension Logger {
/// - message: A description of the error condition.
/// - error: An optional but highly recommended error object.
public static func e(_ tag: String, _ message: String, error: Error? = nil) {
- Logger.shared.e(tag: tag, msg: message, tr: error?.asException())
+ SharedLogger.shared.e(tag: tag, msg: message, tr: error?.asException())
}
+
}
extension Error {
diff --git a/logger/src/jvmMain/kotlin/dev/scarlet/logger/DefaultLogger.kt b/logger/src/jvmMain/kotlin/dev/scarlet/logger/DefaultLogger.kt
index 2a56fef..a0cfff9 100644
--- a/logger/src/jvmMain/kotlin/dev/scarlet/logger/DefaultLogger.kt
+++ b/logger/src/jvmMain/kotlin/dev/scarlet/logger/DefaultLogger.kt
@@ -23,7 +23,7 @@ package dev.scarlet.logger
* > [Logger] implementation.
*
* @author Scarlet Pan
- * @since 1.0.0
+ * @version 1.0.1
*/
object DefaultLogger {
@@ -39,7 +39,7 @@ object DefaultLogger {
*/
@JvmOverloads
@JvmStatic
- fun d(tag: String, msg: String, tr: Throwable? = null) = Logger.default.d(tag, msg, tr)
+ fun d(tag: String, msg: String, tr: Throwable? = null) = Logger.d(tag, msg, tr)
/**
@@ -53,7 +53,7 @@ object DefaultLogger {
*/
@JvmOverloads
@JvmStatic
- fun i(tag: String, msg: String, tr: Throwable? = null) = Logger.default.i(tag, msg, tr)
+ fun i(tag: String, msg: String, tr: Throwable? = null) = Logger.i(tag, msg, tr)
/**
* Logs a WARN-level message with only a throwable (no explicit message).
@@ -64,7 +64,7 @@ object DefaultLogger {
* @param tr The throwable (must be non-null).
*/
@JvmStatic
- fun w(tag: String, tr: Throwable) = Logger.default.w(tag, tr)
+ fun w(tag: String, tr: Throwable) = Logger.w(tag, tr)
/**
* Logs a message at the WARN level.
@@ -77,7 +77,7 @@ object DefaultLogger {
*/
@JvmOverloads
@JvmStatic
- fun w(tag: String, msg: String, tr: Throwable? = null) = Logger.default.w(tag, msg, tr)
+ fun w(tag: String, msg: String, tr: Throwable? = null) = Logger.w(tag, msg, tr)
/**
* Logs a message at the ERROR level.
@@ -91,6 +91,6 @@ object DefaultLogger {
*/
@JvmOverloads
@JvmStatic
- fun e(tag: String, msg: String, tr: Throwable? = null) = Logger.default.e(tag, msg, tr)
+ fun e(tag: String, msg: String, tr: Throwable? = null) = Logger.e(tag, msg, tr)
}
\ No newline at end of file