All Projects → orhanobut → Logger

orhanobut / Logger

Licence: apache-2.0
✔️ Simple, pretty and powerful logger for android

Programming Languages

java
68154 projects - #9 most used programming language
kotlin
9241 projects

Projects that are alternatives of or similar to Logger

Xlog
Android logger, pretty, powerful and flexible, log to everywhere, save to file, all you want is here.
Stars: ✭ 2,468 (-81.15%)
Mutual labels:  log, logger, logcat
datalogger
DataLogger foi projetado para ser uma biblioteca simples de log com suporte a vários providers.
Stars: ✭ 46 (-99.65%)
Mutual labels:  log, logger, logcat
Multiplatform-Log
Kotlin Multi Platform Logger, for android an ios : Logcat & print
Stars: ✭ 49 (-99.63%)
Mutual labels:  log, logger, timber
Lajax
🚀 lajax - 前端日志解决方案。
Stars: ✭ 181 (-98.62%)
Mutual labels:  log, logger
Signale
Highly configurable logging utility
Stars: ✭ 8,575 (-34.51%)
Mutual labels:  log, logger
Android Filelogger
A general-purpose logging library with built-in support to save logs to file efficiently.
Stars: ✭ 70 (-99.47%)
Mutual labels:  log, logger
Serverless Es Logs
A Serverless plugin to transport logs to ElasticSearch
Stars: ✭ 51 (-99.61%)
Mutual labels:  log, logger
Rain
Visualize vertical data inside your terminal 💦
Stars: ✭ 84 (-99.36%)
Mutual labels:  log, logger
Loguru
Python logging made (stupidly) simple
Stars: ✭ 10,510 (-19.73%)
Mutual labels:  log, logger
Easy Log Handler
Human-friendly log files that make you more productive
Stars: ✭ 2,070 (-84.19%)
Mutual labels:  log, logger
Heliumlogger
A lightweight logging framework for Swift
Stars: ✭ 169 (-98.71%)
Mutual labels:  log, logger
Yii2 Psr Log Target
Yii 2.0 log target that is able to write messages to PSR-3 compatible logger
Stars: ✭ 58 (-99.56%)
Mutual labels:  log, logger
Logger
Simple logger with stores inspector
Stars: ✭ 58 (-99.56%)
Mutual labels:  log, logger
Logtofile
Android一个简单实用把Log日志打印到手机本地文件,可以自行取出来上传到服务器开源代码
Stars: ✭ 74 (-99.43%)
Mutual labels:  log, logger
Plog
Portable, simple and extensible C++ logging library
Stars: ✭ 1,061 (-91.9%)
Mutual labels:  log, logger
Coolog
A expandable and flexible log framework for iOS. iOS一个灵活、可扩展的日志组件。
Stars: ✭ 82 (-99.37%)
Mutual labels:  log, logger
Serverlog
A simple, practical and innovative Node.js log library that enables you to view logs in Chrome dev tools and browser Console.
Stars: ✭ 117 (-99.11%)
Mutual labels:  log, logger
Easylogger
An ultra-lightweight(ROM<1.6K, RAM<0.3k), high-performance C/C++ log library. | 一款超轻量级(ROM<1.6K, RAM<0.3k)、高性能的 C/C++ 日志库
Stars: ✭ 1,968 (-84.97%)
Mutual labels:  log, logger
Go Logger
一个简单而强大的 golang 日志工具包,支持同步和异步输出到 命令行,文件, api 接口,文件支持按文件大小,文件行数,日期切分;A simple and powerful golang logging toolkit that supports synchronous and asynchronous output to the console, file, API interfaces, file support by file size, file line number, date sharding.
Stars: ✭ 152 (-98.84%)
Mutual labels:  log, logger
Logcustom
A simple log customization tool based on golang 一个基于golang简单的日志定制化工具
Stars: ✭ 46 (-99.65%)
Mutual labels:  log, logger

Android Arsenal Join the chat at https://gitter.im/orhanobut/logger Build Status

Logger

Simple, pretty and powerful logger for android

Setup

Download

implementation 'com.orhanobut:logger:2.2.0'

Initialize

Logger.addLogAdapter(new AndroidLogAdapter());

And use

Logger.d("hello");

Output

Options

Logger.d("debug");
Logger.e("error");
Logger.w("warning");
Logger.v("verbose");
Logger.i("information");
Logger.wtf("What a Terrible Failure");

String format arguments are supported

Logger.d("hello %s", "world");

Collections are supported (only available for debug logs)

Logger.d(MAP);
Logger.d(SET);
Logger.d(LIST);
Logger.d(ARRAY);

Json and Xml support (output will be in debug level)

Logger.json(JSON_CONTENT);
Logger.xml(XML_CONTENT);

Advanced

FormatStrategy formatStrategy = PrettyFormatStrategy.newBuilder()
  .showThreadInfo(false)  // (Optional) Whether to show thread info or not. Default true
  .methodCount(0)         // (Optional) How many method line to show. Default 2
  .methodOffset(7)        // (Optional) Hides internal method calls up to offset. Default 5
  .logStrategy(customLog) // (Optional) Changes the log strategy to print out. Default LogCat
  .tag("My custom tag")   // (Optional) Global tag for every log. Default PRETTY_LOGGER
  .build();

Logger.addLogAdapter(new AndroidLogAdapter(formatStrategy));

Loggable

Log adapter checks whether the log should be printed or not by checking this function. If you want to disable/hide logs for output, override isLoggable method. true will print the log message, false will ignore it.

Logger.addLogAdapter(new AndroidLogAdapter() {
  @Override public boolean isLoggable(int priority, String tag) {
    return BuildConfig.DEBUG;
  }
});

Save logs to the file

//TODO: More information will be added later

Logger.addLogAdapter(new DiskLogAdapter());

Add custom tag to Csv format strategy

FormatStrategy formatStrategy = CsvFormatStrategy.newBuilder()
  .tag("custom")
  .build();
  
Logger.addLogAdapter(new DiskLogAdapter(formatStrategy));

How it works

More

  • Use filter for a better result. PRETTY_LOGGER or your custom tag
  • Make sure that wrap option is disabled
  • You can also simplify output by changing settings.

  • Timber Integration
// Set methodOffset to 5 in order to hide internal method calls
Timber.plant(new Timber.DebugTree() {
  @Override protected void log(int priority, String tag, String message, Throwable t) {
    Logger.log(priority, tag, message, t);
  }
});

License

Copyright 2018 Orhan Obut

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].