Git Product home page Git Product logo

kermit-extensions's Introduction

Kermit Extensions

Maven Central Kotlin PRs Welcome GitHub License

Welcome to Kermit Extensions, a collection of utilities aimed at enhancing the debugging experience by leveraging the powerful logging API of Kermit. This repository is home to custom extensions designed to make your development process smoother, more efficient, and ultimately more productive.

About Kermit

Kermit is a Kotlin Multiplatform logging utility that provides a common logging interface for all platforms. While Kermit itself offers extensive capabilities, our extensions are here to fill in specific needs that arise during the development and debugging processes.

Current Extensions

TxtLogWriter

TxtLogWriter, is a custom LogWriter that, when integrated with Kermit, allows you to write logs to a .txt file. This is particularly useful for sharing logs with teammates or for detailed analysis during the debugging process. It’s designed to be easy to set up and integrates seamlessly with your existing Kermit setup. Currently, TxtLogWriter is available for Android, iOS and desktop platforms.

Instalation

To integrate TxtLogWriter into your Kotlin Multiplatform project, add the following dependency to your build.gradle.kts (for Kotlin DSL) file within the commonMain source set. Please ensure to replace <latest.version> with the most current version of TxtLogWriter available.

sourceSets {
    commonMain.dependencies {
        implementation("dev.theolm:txtlogwriter:<last.version>")
    }
}

Usage Guidelines

To employ TxtLogWriter within your application, instantiate and register it as a log writer with Kermit using the following syntax. The default configuration is optimized for immediate use in most scenarios, allowing for straightforward integration without additional adjustments.

Logger.addLogWriter(TxtLogWriter())

TxtLogWriter is designed to operate without specific operating system permissions and will automatically create a new log file, named after the current date and time, upon each application initialization.

For situations that demand customized log configurations, TxtLogWriter supports instantiation with detailed settings to better align with your specific logging needs:

TxtLogWriter(
    config = TxtLogWriter.Config(
        filePath = "path/to/log/directory", // Define the directory path for the log files.
        fileName = "custom_log_file.txt", // Set the name of the log file, which must end with .txt.
        linePrefix = LinePrefix.Time, // Select a prefix to add before each log message.
        canWrite = { tag, severity -> true }, // Function to determine whether a log entry should be written.
        customMessageBuilder = CustomMessageBuilder() // Optionally, define a custom format for log messages.
    )
)

Supported Line prefix:

LinePrefix.None // Omits the prefix from log messages.
LinePrefix.Date // Adds the date of the log entry as a prefix to messages.
LinePrefix.Time // Adds the time of the log entry as a prefix to messages.
LinePrefix.DateTime // Prefixes log messages with both the date and time of the entry.
LinePrefix.Custom // Enables the use of a custom-defined prefix for log messages.

kermit-extensions's People

Contributors

theolm avatar

Stargazers

Gabriel Bronzatti Moro avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.