A simple Kotlin multi-platform logging abstraction.
This library provides simple interfaces to wrap any logging utility and use them in Kotlin Multiplatform code.
Log.error("Error message.")
- Assign the
Logger
implementation to theLog.logger
property (defaults toDefaultLogger
):
Log.logger = DefaultLogger()
- Optionally, call the
LogInitializer.init
:
Log.init()
- Log anything:
Log.error(message = "Error Message", throwable = someException)
The library provides multiple platform specific Logger
implementations that could be used or extended. For instance:
DefaultLogger
- Platform default logging.- Android:
LogCatLogger
- JVM:
JavaLogger
- JS:
ConsoleLogger
- iOS:
NSLogger
- Android:
DelegatingLogger
- Delegates to one or moreLoggers
.SimplePrintLineLogger
- Uses theprintln()
Kotlin function.NoActionLogger
- No operation Logger.
ConsoleLogger
- Uses the browser console.
JavaLogger
- Uses the JVM Logger class.JavaAnnotationProcessorMessagerLogger
- Uses the JVM Messager class used in Annotation Processors.
LogCatLogger
- Uses the Android Log functions.
TimberLogger
- Uses the Android Timber Library.
NSLogger
- UsesNSLog
.
The library is provided through repsy.io. Refer to
the releases page for the latest version.
repositories {
maven { url = "https://repo.repsy.io/mvn/chrynan/public" }
}
Core Module:
implementation("com.chrynan.logger:logger-core:$VERSION")
Android Timber Module:
implementation("com.chrynan.logger:logger-android-timber:$VERSION-release")
More detailed documentation is available in the docs folder. The entry point to the documentation can be found here.
Copyright 2021 chRyNaN
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.