
Simple logging library offers customizable log output, supports multiple log levels, and logs exceptions with stack traces. Enables consistent logging across applications with custom delegate functions.
Hog is a logging library for Kotlin Multiplatform Mobile (KMM) , designed to provide a simple logging solution for your applications. It supports Android, iOS platforms, allowing you to have consistent logging functionality across multiple platforms.
Multiple log levels: Hog supports different log levels, including VERBOSE, DEBUG, INFO, WARN, and ERROR.
Customizable log output: You can define your own log delegate function to handle the logging output.
Throwable support: Hog allows you to log exceptions and stack traces along with your log messages.
To start using Hog in your KMM project, follow these steps:
kotlin {
// ...
sourceSets {
val commonMain by getting {
dependencies {
implementation("top.heiha.huntun:hog:$latestVersion")
}
}
// ...
}
}import com.example.hog.logv
import com.example.hog.logi
import com.example.hog.loge
fun someFunction() {
logv("TAG", "Verbose log message")
logi("TAG", "Info log message")
loge("TAG", "Error log message", Throwable("Something went wrong"))
}Hog supports the following log levels:
Hog allows you to define your own log delegate function to handle the logging output. By default, it uses the log function provided by the library. However, you can override this behavior by assigning your custom log delegate function to the logDelegate variable.
logDelegate = ::myLogDelegate
fun myLogDelegate(level: LogLevel, tag: String, msg: String, tr: Throwable?) {
// Implement your custom logging logic here
}In your custom log delegate function, you can define how the log messages should be processed and outputted. You have access to the log level, tag, message, and optional throwable object.
Hog allows you to log exceptions and stack traces along with your log messages. When logging an error or an exception, you can pass a throwable object as an optional parameter.
loge("TAG", "Error log message", Throwable("Something went wrong"))The throwable object will be converted to a string representation, including the stack trace, and appended to the log message.
This library is licensed under the MIT License. You are free to use, modify, and distribute this library.
Hog is a logging library for Kotlin Multiplatform Mobile (KMM) , designed to provide a simple logging solution for your applications. It supports Android, iOS platforms, allowing you to have consistent logging functionality across multiple platforms.
Multiple log levels: Hog supports different log levels, including VERBOSE, DEBUG, INFO, WARN, and ERROR.
Customizable log output: You can define your own log delegate function to handle the logging output.
Throwable support: Hog allows you to log exceptions and stack traces along with your log messages.
To start using Hog in your KMM project, follow these steps:
kotlin {
// ...
sourceSets {
val commonMain by getting {
dependencies {
implementation("top.heiha.huntun:hog:$latestVersion")
}
}
// ...
}
}import com.example.hog.logv
import com.example.hog.logi
import com.example.hog.loge
fun someFunction() {
logv("TAG", "Verbose log message")
logi("TAG", "Info log message")
loge("TAG", "Error log message", Throwable("Something went wrong"))
}Hog supports the following log levels:
Hog allows you to define your own log delegate function to handle the logging output. By default, it uses the log function provided by the library. However, you can override this behavior by assigning your custom log delegate function to the logDelegate variable.
logDelegate = ::myLogDelegate
fun myLogDelegate(level: LogLevel, tag: String, msg: String, tr: Throwable?) {
// Implement your custom logging logic here
}In your custom log delegate function, you can define how the log messages should be processed and outputted. You have access to the log level, tag, message, and optional throwable object.
Hog allows you to log exceptions and stack traces along with your log messages. When logging an error or an exception, you can pass a throwable object as an optional parameter.
loge("TAG", "Error log message", Throwable("Something went wrong"))The throwable object will be converted to a string representation, including the stack trace, and appended to the log message.
This library is licensed under the MIT License. You are free to use, modify, and distribute this library.