# Customize Kermit Logger syntax in Kotlin Multiplatform

DevFeed: [Customize Kermit Logger syntax in Kotlin Multiplatform](<https://devfeed.tech/articles/logger-i-not-your-style-customize-kermit-logger-24718.md>)

Original publisher: [Read original article](<https://dev.to/touchlab/loggeri-not-your-style-customize-kermit-logger-4fik>)

Author: Jigar Brahmbhatt

Published: 2023-10-24T02:19:28Z

Content type: tutorial

Language: en

Sources: [Touchlab](<https://devfeed.tech/sources/touchlab.md>)

Topics: [Kotlin Multiplatform](<https://devfeed.tech/topics/kotlin-multiplatform.md>), [Library](<https://devfeed.tech/topics/library.md>), [Logging](<https://devfeed.tech/topics/logging.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [coding](<https://devfeed.tech/tags/coding.md>), [community](<https://devfeed.tech/tags/community.md>), [development](<https://devfeed.tech/tags/development.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [inclusive](<https://devfeed.tech/tags/inclusive.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [kotlinmultiplatform](<https://devfeed.tech/tags/kotlinmultiplatform.md>), [library](<https://devfeed.tech/tags/library.md>), [logging](<https://devfeed.tech/tags/logging.md>), [mobile](<https://devfeed.tech/tags/mobile.md>), [software](<https://devfeed.tech/tags/software.md>)

## AI overview

This tutorial shows how to create a custom Logger class around Kermit for Kotlin Multiplatform. It demonstrates replacing Kermit's Logger.i syntax with custom methods such as Logger.info and Logger.error, while noting that the example is a simplified version of the full Logger API.

## Source excerpt

In the realm of Kotlin Multiplatform logging, the Kermit library stands as a trusted companion for developers. However, some find its conventional logger.i syntax less appealing. What if you could improve your logging experience with a touch of personalization? Enter the world of custom logger, where logger.info becomes a reality. Diving into Custom Logging The journey begins with a glance at a custom code snippet that transforms the Kermit logging experience. This code introduces a custom Logger class adorned with methods like info, and error--a testament to the flexibility Kermit provides for tailoring logging to your liking. Note that example code below is a very toned down version of full Logger API. It helps with keeping the code minimal while still delivering the idea behind it. import co.touchlab.kermit.BaseLogger import co.touchlab.kermit.LoggerConfig import co.touchlab.kermit.Severity import co.touchlab.kermit.mutableLoggerConfigInit import co.touchlab.kermit.platformLogWriter open class Logger( config: LoggerConfig, open val tag: String = "MyDefaultTag" ) : BaseLogger(config) { inline fun info(throwable: Throwable? = null, tag: String = this.tag, message: () -> String) { logBlock(Info, tag, throwable, message) } inline fun error(throwable: Throwable? = null, tag: String = this.tag, message: () -> String) { logBlock(Error, tag, throwable, message) } inline fun info(messageString: String, throwable: Throwable? = null, tag: String = this.tag) { log(Info, tag, throwable, messageString) } inline fun error(messageString: String, throwable: Throwable? = null, tag: String = this.tag) { log(Error, tag, throwable, messageString) } companion object : Logger(mutableLoggerConfigInit(listOf(platformLogWriter()))) } Now instead of calling Kermit's API, you can call your own methods. Call Logger.info(...) rather than Logger.i(...) Kermit-core This flexiblity comes from the modularized kermit components. If you prefer to have custom logger then you need to only depends on k