Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions KmpLogger.podspec
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
10 changes: 5 additions & 5 deletions KmpLogger.xcframework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,32 @@
<key>BinaryPath</key>
<string>KmpLogger.framework/KmpLogger</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>KmpLogger.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>KmpLogger.framework/KmpLogger</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>KmpLogger.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#import <Foundation/NSString.h>
#import <Foundation/NSValue.h>

@class KmpLoggerKotlinThrowable, LoggingLevel, KmpLoggerAbsLogger, Logger, KmpLoggerKotlinEnumCompanion, KmpLoggerKotlinEnum<E>, KmpLoggerKotlinArray<T>;
@class KmpLoggerKotlinThrowable, KmpLoggerLoggerLevel, KmpLoggerAbsLogger, SharedLogger, KmpLoggerKotlinEnumCompanion, KmpLoggerKotlinEnum<E>, KmpLoggerKotlinArray<T>;

@protocol Logging, KmpLoggerKotlinComparable, KmpLoggerKotlinIterator;
@protocol KmpLoggerLogger, KmpLoggerKotlinComparable, KmpLoggerKotlinIterator;

NS_ASSUME_NONNULL_BEGIN
#pragma clang diagnostic push
Expand Down Expand Up @@ -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:)")));
Expand All @@ -154,7 +155,7 @@ __attribute__((swift_name("KotlinBoolean")))
@end

__attribute__((swift_name("AbsLogger")))
@interface KmpLoggerAbsLogger : KmpLoggerBase <Logging>
@interface KmpLoggerAbsLogger : KmpLoggerBase <KmpLoggerLogger>
- (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:)")));
Expand All @@ -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<Logging> SYSTEM __attribute__((swift_name("SYSTEM")));
@property (readonly) id<KmpLoggerLogger> SYSTEM __attribute__((swift_name("SYSTEM")));

/**
* @note annotations
* kotlin.jvm.JvmStatic
*/
@property (getter=default, setter=setDefault:) id<Logging> default_ __attribute__((swift_name("default_")));
@property (getter=default, setter=setDefault:) id<KmpLoggerLogger> default_ __attribute__((swift_name("default_")));
@end

__attribute__((swift_name("KotlinComparable")))
Expand All @@ -214,16 +215,17 @@ __attribute__((swift_name("KotlinEnum")))
@end

__attribute__((objc_subclassing_restricted))
@interface LoggingLevel : KmpLoggerKotlinEnum<LoggingLevel *>
__attribute__((swift_name("LoggerLevel")))
@interface KmpLoggerLoggerLevel : KmpLoggerKotlinEnum<KmpLoggerLoggerLevel *>
+ (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<LoggingLevel *> *)values __attribute__((swift_name("values()")));
@property (class, readonly) NSArray<LoggingLevel *> *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<KmpLoggerLoggerLevel *> *)values __attribute__((swift_name("values()")));
@property (class, readonly) NSArray<KmpLoggerLoggerLevel *> *entries __attribute__((swift_name("entries")));
@end

__attribute__((objc_subclassing_restricted))
Expand All @@ -234,7 +236,7 @@ __attribute__((swift_name("CompositeLoggerKt")))
* @note annotations
* kotlin.jvm.JvmName(name="combine")
*/
+ (id<Logging>)plus:(id<Logging>)receiver other:(id<Logging>)other __attribute__((swift_name("plus(_:other:)")));
+ (id<KmpLoggerLogger>)plus:(id<KmpLoggerLogger>)receiver other:(id<KmpLoggerLogger>)other __attribute__((swift_name("plus(_:other:)")));
@end

__attribute__((objc_subclassing_restricted))
Expand All @@ -245,7 +247,7 @@ __attribute__((swift_name("LoggersKt")))
* @note annotations
* kotlin.jvm.JvmOverloads
*/
+ (void)log:(id<Logging>)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<KmpLoggerLogger>)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")))
Expand Down
Binary file modified KmpLogger.xcframework/ios-arm64/KmpLogger.framework/KmpLogger
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#import <Foundation/NSString.h>
#import <Foundation/NSValue.h>

@class KmpLoggerKotlinThrowable, LoggingLevel, KmpLoggerAbsLogger, Logger, KmpLoggerKotlinEnumCompanion, KmpLoggerKotlinEnum<E>, KmpLoggerKotlinArray<T>;
@class KmpLoggerKotlinThrowable, KmpLoggerLoggerLevel, KmpLoggerAbsLogger, SharedLogger, KmpLoggerKotlinEnumCompanion, KmpLoggerKotlinEnum<E>, KmpLoggerKotlinArray<T>;

@protocol Logging, KmpLoggerKotlinComparable, KmpLoggerKotlinIterator;
@protocol KmpLoggerLogger, KmpLoggerKotlinComparable, KmpLoggerKotlinIterator;

NS_ASSUME_NONNULL_BEGIN
#pragma clang diagnostic push
Expand Down Expand Up @@ -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:)")));
Expand All @@ -154,7 +155,7 @@ __attribute__((swift_name("KotlinBoolean")))
@end

__attribute__((swift_name("AbsLogger")))
@interface KmpLoggerAbsLogger : KmpLoggerBase <Logging>
@interface KmpLoggerAbsLogger : KmpLoggerBase <KmpLoggerLogger>
- (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:)")));
Expand All @@ -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<Logging> SYSTEM __attribute__((swift_name("SYSTEM")));
@property (readonly) id<KmpLoggerLogger> SYSTEM __attribute__((swift_name("SYSTEM")));

/**
* @note annotations
* kotlin.jvm.JvmStatic
*/
@property (getter=default, setter=setDefault:) id<Logging> default_ __attribute__((swift_name("default_")));
@property (getter=default, setter=setDefault:) id<KmpLoggerLogger> default_ __attribute__((swift_name("default_")));
@end

__attribute__((swift_name("KotlinComparable")))
Expand All @@ -214,16 +215,17 @@ __attribute__((swift_name("KotlinEnum")))
@end

__attribute__((objc_subclassing_restricted))
@interface LoggingLevel : KmpLoggerKotlinEnum<LoggingLevel *>
__attribute__((swift_name("LoggerLevel")))
@interface KmpLoggerLoggerLevel : KmpLoggerKotlinEnum<KmpLoggerLoggerLevel *>
+ (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<LoggingLevel *> *)values __attribute__((swift_name("values()")));
@property (class, readonly) NSArray<LoggingLevel *> *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<KmpLoggerLoggerLevel *> *)values __attribute__((swift_name("values()")));
@property (class, readonly) NSArray<KmpLoggerLoggerLevel *> *entries __attribute__((swift_name("entries")));
@end

__attribute__((objc_subclassing_restricted))
Expand All @@ -234,7 +236,7 @@ __attribute__((swift_name("CompositeLoggerKt")))
* @note annotations
* kotlin.jvm.JvmName(name="combine")
*/
+ (id<Logging>)plus:(id<Logging>)receiver other:(id<Logging>)other __attribute__((swift_name("plus(_:other:)")));
+ (id<KmpLoggerLogger>)plus:(id<KmpLoggerLogger>)receiver other:(id<KmpLoggerLogger>)other __attribute__((swift_name("plus(_:other:)")));
@end

__attribute__((objc_subclassing_restricted))
Expand All @@ -245,7 +247,7 @@ __attribute__((swift_name("LoggersKt")))
* @note annotations
* kotlin.jvm.JvmOverloads
*/
+ (void)log:(id<Logging>)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<KmpLoggerLogger>)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")))
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import kotlin.test.assertEquals

/**
* @author Scarlet Pan
* @since 1.0.0
* @version 1.0.0
*/
class Slf4jLoggerTest {

Expand Down
2 changes: 1 addition & 1 deletion logger/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group = "io.github.scarlet-pan"
version = "1.1.0-beta"
version = "1.1.0"

val xcfName = "KmpLogger"

Expand Down
5 changes: 4 additions & 1 deletion logger/src/commonMain/kotlin/dev/scarlet/logger/AbsLogger.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
@file:OptIn(ExperimentalObjCName::class)

package dev.scarlet.logger

import dev.scarlet.logger.Logger.Level
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
Expand All @@ -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 {

Expand Down
5 changes: 2 additions & 3 deletions logger/src/commonMain/kotlin/dev/scarlet/logger/Logger.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import kotlin.native.ObjCName
* @author Scarlet Pan
* @version 1.0.1
*/
@ObjCName("Logging", exact = true)
interface Logger {

/**
Expand All @@ -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"
Expand Down Expand Up @@ -166,7 +165,7 @@ interface Logger {
* ```
*
* @author Scarlet Pan
* @since 1.0.0
* @version 1.0.0
*/
enum class Level {

Expand Down
Loading