All Projects → ajalt → Timberkt

ajalt / Timberkt

Licence: apache-2.0
Easy Android logging with Kotlin and Timber

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Timberkt

Zap
Blazing fast, structured, leveled logging in Go.
Stars: ✭ 14,384 (+7391.67%)
Mutual labels:  logging
Defmt
Efficient, deferred formatting for logging on embedded systems
Stars: ✭ 172 (-10.42%)
Mutual labels:  logging
Logrange
High performance data aggregating storage
Stars: ✭ 181 (-5.73%)
Mutual labels:  logging
Loki
Like Prometheus, but for logs.
Stars: ✭ 14,483 (+7443.23%)
Mutual labels:  logging
Graylog Ansible Role
Ansible role which installs and configures Graylog
Stars: ✭ 173 (-9.9%)
Mutual labels:  logging
Laravel Auditing
Record the change log from models in Laravel
Stars: ✭ 2,210 (+1051.04%)
Mutual labels:  logging
Exceptionless
Exceptionless server and jobs
Stars: ✭ 2,107 (+997.4%)
Mutual labels:  logging
Acho
The Hackable Log
Stars: ✭ 189 (-1.56%)
Mutual labels:  logging
Blackhole
Yet another logging library.
Stars: ✭ 173 (-9.9%)
Mutual labels:  logging
Cloudlog
Web based amateur radio logging application built using PHP & MySQL supports general station logging tasks from HF to Microwave with supporting applications to support CAT control.
Stars: ✭ 179 (-6.77%)
Mutual labels:  logging
Logster
Easily parsable single line, plain text and JSON logger for Plug and Phoenix applications
Stars: ✭ 171 (-10.94%)
Mutual labels:  logging
Winston Cloudwatch
Send logs to Amazon Cloudwatch using Winston.
Stars: ✭ 172 (-10.42%)
Mutual labels:  logging
Monolog Bridge
Provides integration for Monolog with various Symfony components.
Stars: ✭ 2,238 (+1065.63%)
Mutual labels:  logging
Cocoalumberjack
A fast & simple, yet powerful & flexible logging framework for Mac and iOS
Stars: ✭ 12,584 (+6454.17%)
Mutual labels:  logging
Logrus Prefixed Formatter
Logrus Prefixed Log Formatter
Stars: ✭ 181 (-5.73%)
Mutual labels:  logging
Logstash
Logstash - transport and process your logs, events, or other data
Stars: ✭ 12,543 (+6432.81%)
Mutual labels:  logging
Cls Rtracer
Request Tracer - CLS-based request id generation for Express, Fastify, Koa and Hapi, batteries included
Stars: ✭ 175 (-8.85%)
Mutual labels:  logging
Logcat
Android 日志打印框架,在手机上可以直接看到 Logcat 日志啦
Stars: ✭ 189 (-1.56%)
Mutual labels:  logging
Spf4j
Simple performance framework for java
Stars: ✭ 184 (-4.17%)
Mutual labels:  logging
Yii2 Debug
Debug Extension for Yii 2
Stars: ✭ 179 (-6.77%)
Mutual labels:  logging

Kotlin logging extensions for Timber

Jake Wharton's Timber library is great. It's a Java library with an API that works well for Java, but that isn't as idiomatic when used in Kotlin.

This library builds on Timber with an API that's easier to use from Kotlin. Instead of using formatting parameters, you pass a lambda that is only evaluated if the message is logged.

Usage

  1. Configure any Tree instances in your Application's onCreate, the same way as with plain Timber.
  2. Call the extension functions from anywhere in your code.
// Standard timber
Timber.d("%d %s", intVar + 3, stringFun())

// Kotlin extensions
Timber.d { "${intVar + 3} ${stringFun()}" }
// or
d { "${intVar + 3} ${stringFun()}" }

The same message and tags will be logged in all three cases.

The Kotlin extensions have the advantage of being more convenient to write, and are also more performant in some circumstances. The passed block is only evaluated if the message is logged, and even if the message is logged to multiple trees, the block is only evaluated once. All extension methods are inlined, so there is no method count penalty to using this library.

Logging exception objects works the same way:

// Standard timber
Timber.e(exception, "%d exceptions", errorCount)

// Kotlin extensions
Timber.e(exception) { "$errorCount exceptions" }
// or
e(exception) { "$errorCount exceptions" }

What about Timber's custom lint checks?

Timber comes with half a dozen lint checks that help you spot incorrect usage of the log calls.

With the exception of long custom tags, none of the errors those checks look for are possible with this library. You can perform arbitrary code inside of the lambdas passed to the log extensions, and there's no risk of performance problems in your release code since the blocks won't be evaluated unless the messages are printed.

Download

The Kotlin extensions for Timber are distributed with Maven Central, JCenter and JitPack.

implementation 'com.github.ajalt:timberkt:1.5.1'

Documentation

The documentation is hosted online here.

License

Copyright 2017-2018 AJ Alt

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].