-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add TemplateContext and related classes * Add TemplateContext and associated classes to LogContext * Add MessageParser and DateTimeFormat tests * Add IgnoreIos annotation to skip tests running on iOS (iOS is not implemented yet and would fail) * Finish adding tests * Add KTags and add it to KLogContext * Add Platform and DefaultPlatform * Formatting * Fix iOS build error * Fix findLoggingClass not working on Kotlin through StackWalker * Formatting * Remove print * Fix tests * Implement basic logging capabilities with NSLog * Add capability to log with OSLog on iOS * Apply formatting * Add functioing KFluentLogger * Update NSThreadBasedCallerFinder * Implement basic logging * Formatting * Enable autoservice again * Fix jvm tests * update kflogger publish * Add printf formatting * fmt * add improvements * fix tests * add lazy evaluations * fmt * fmt:
- Loading branch information
Showing
311 changed files
with
2,824 additions
and
1,479 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
api/src/commonMain/kotlin/com.giancarlobuenaflor.kflogger/KLazyArg.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.giancarlobuenaflor.kflogger | ||
|
||
/** | ||
* Functional interface for allowing lazily evaluated arguments to be supplied to Flogger. This | ||
* allows callers to defer argument evaluation efficiently when: | ||
* <ul> | ||
* <li>Doing "fine" logging that's normally disabled | ||
* <li>Applying rate limiting to log statements | ||
* </ul> | ||
*/ | ||
public expect fun interface KLazyArg<T> { | ||
/** | ||
* Computes a value to use as a log argument. This method is invoked once the Flogger library has | ||
* determined that logging will occur, and the returned value is used in place of the `LazyArg` | ||
* instance that was passed into the log statement. | ||
*/ | ||
public fun evaluate(): T? | ||
} |
34 changes: 34 additions & 0 deletions
34
api/src/commonMain/kotlin/com.giancarlobuenaflor.kflogger/KLazyArgs.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.giancarlobuenaflor.kflogger | ||
|
||
/** | ||
* Static utility methods for lazy argument evaluation in Flogger. The [.lazy] method allows lambda | ||
* expressions to be "cast" to the [LazyArg] interface. | ||
* | ||
* In cases where the log statement is strongly expected to always be enabled (e.g. unconditional | ||
* logging at warning or above) it may not be worth using lazy evaluation because any work required | ||
* to evaluate arguments will happen anyway. | ||
* | ||
* If lambdas are available, users should prefer using this class rather than explicitly creating | ||
* `LazyArg` instances. | ||
*/ | ||
// TODO: Add other generally useful methods here, especially things which help non-lambda users. | ||
public expect class KLazyArgs { | ||
public companion object { | ||
/** | ||
* Coerces a lambda expression or method reference to return a lazily evaluated logging | ||
* argument. Pass in a compatible, no-argument, lambda expression or method reference to have it | ||
* evaluated only when logging will actually occur. | ||
* <pre>`logger.atFine().log("value=%s", lazy(() -> doExpensive())); | ||
* logger.atWarning().atMostEvery(5, MINUTES).log("value=%s", lazy(stats::create)); | ||
* `</pre> * | ||
* | ||
* Evaluation of lazy arguments occurs at most once, and always in the same thread from which | ||
* the logging call was made. | ||
* | ||
* Note also that it is almost never suitable to make a `toString()` call "lazy" using this | ||
* mechanism and, in general, explicitly calling `toString()` on arguments which are being | ||
* logged is an error as it precludes the ability to log an argument structurally. | ||
*/ | ||
public fun <T> lazy(lambdaOrMethodReference: KLazyArg<T>): KLazyArg<T> | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...flor/kflogger/KLogPerBucketingStrategy.kt → ...flor.kflogger/KLogPerBucketingStrategy.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...tlin/com/buenaflor/kflogger/KLogRecord.kt → ...giancarlobuenaflor.kflogger/KLogRecord.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
package com.buenaflor.kflogger | ||
package com.giancarlobuenaflor.kflogger | ||
|
||
public expect class KLogRecord(level: KLevel, message: String) |
2 changes: 1 addition & 1 deletion
2
...kotlin/com/buenaflor/kflogger/KLogSite.kt → ...m.giancarlobuenaflor.kflogger/KLogSite.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
api/src/commonMain/kotlin/com.giancarlobuenaflor.kflogger/KLogger.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.giancarlobuenaflor.kflogger | ||
|
||
public expect class KLogger { | ||
public fun isLoggable(level: KLevel): Boolean | ||
} |
2 changes: 1 addition & 1 deletion
2
...lin/com/buenaflor/kflogger/KLoggingApi.kt → ...iancarlobuenaflor.kflogger/KLoggingApi.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...n/com/buenaflor/kflogger/KLoggingScope.kt → ...ncarlobuenaflor.kflogger/KLoggingScope.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...enaflor/kflogger/KLoggingScopeProvider.kt → ...enaflor.kflogger/KLoggingScopeProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...in/com/buenaflor/kflogger/KMetadataKey.kt → ...ancarlobuenaflor.kflogger/KMetadataKey.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...om/buenaflor/kflogger/KRateLimitStatus.kt → ...rlobuenaflor.kflogger/KRateLimitStatus.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...tlin/com/buenaflor/kflogger/KStackSize.kt → ...giancarlobuenaflor.kflogger/KStackSize.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...otlin/com/buenaflor/kflogger/KTimeUnit.kt → ....giancarlobuenaflor.kflogger/KTimeUnit.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
api/src/commonMain/kotlin/com.giancarlobuenaflor.kflogger/Klass.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.giancarlobuenaflor.kflogger | ||
|
||
import kotlin.reflect.KClass | ||
|
||
/** | ||
* The bridge class used to typealias `Class` for JVM and `KClass` for iOS. However, Class and | ||
* KClass have different signatures, so it is not possible to automatically typealias them with the | ||
* same class at once. The solution here is to save the `KClass` as a property of `Klass` in the iOS | ||
* implementation. | ||
* | ||
* Accessing the respective `Class` or `KClass` is done via the `toKlass()` extension function. | ||
*/ | ||
public expect class Klass<T : Any> | ||
|
||
/** Extension function to convert a `KClass` to a `Klass`. */ | ||
public expect fun <T : Any> KClass<T>.toKlass(): Klass<T> |
Oops, something went wrong.