All Projects → Pulimet → MyLogLibrary

Pulimet / MyLogLibrary

Licence: other
🚧 - Simple Android Kotlin logger (2017/2020)

Programming Languages

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

Projects that are alternatives of or similar to MyLogLibrary

hat-view
Allow to put "hat" on TextView. Inspired by Telegram appbar title with Santa Claus hat 🎅🏻
Stars: ✭ 51 (+64.52%)
Mutual labels:  androidx, androidx-library
datalogger
DataLogger foi projetado para ser uma biblioteca simples de log com suporte a vários providers.
Stars: ✭ 46 (+48.39%)
Mutual labels:  logcat
Component
🔥🔥🔥A powerful componentized framework.一个强大、100% 兼容、支持 AndroidX、支持 Kotlin并且灵活的组件化框架
Stars: ✭ 2,434 (+7751.61%)
Mutual labels:  androidx
logcat-colorize
Command that takes adb logcat from stdin and produces formatted colorized to stdout, written in C++.
Stars: ✭ 21 (-32.26%)
Mutual labels:  logcat
slf4j-handroid
Android logging done right
Stars: ✭ 17 (-45.16%)
Mutual labels:  android-logger
Logger
✔️ Simple, pretty and powerful logger for android
Stars: ✭ 13,093 (+42135.48%)
Mutual labels:  logcat
Aesthetic
[DEPRECATED]
Stars: ✭ 2,044 (+6493.55%)
Mutual labels:  androidx
nice-animals
Simple android app that shows nice animals pictures
Stars: ✭ 15 (-51.61%)
Mutual labels:  androidx
slf4j-timber
SLF4J binding for Timber - a logger with a small, extensible API which provides utility on top of Android's normal Log class.
Stars: ✭ 20 (-35.48%)
Mutual labels:  logcat
dora
🌟Dora is an open-source framework focused on usability and flexibility.It is widely used to collect crash information and print variable values.It is very powerful and useful to debug android program. It is customizable and extensible in the simpleton-like ways. Dora是一个专注于易用性和灵活性的开源框架,它被广泛用于收集崩溃信息和打印变量值,对调试Android程序非常强大和有用,傻瓜式的自定义和扩展。
Stars: ✭ 15 (-51.61%)
Mutual labels:  logcat
aixlog
Header-only C++ logging library
Stars: ✭ 95 (+206.45%)
Mutual labels:  logcat
TLog
Android日志工具
Stars: ✭ 16 (-48.39%)
Mutual labels:  logcat
Xlog
Android logger, pretty, powerful and flexible, log to everywhere, save to file, all you want is here.
Stars: ✭ 2,468 (+7861.29%)
Mutual labels:  logcat
clue
a extremely high performance log library for android. 高性能的Android日志库
Stars: ✭ 27 (-12.9%)
Mutual labels:  android-logger
raffler-kotlin
A raffling app developed as a playground to study many topics related to Android. Kotlin + Coroutines + MVVM
Stars: ✭ 44 (+41.94%)
Mutual labels:  androidx
Bgaswipebacklayout Android
Android Activity 滑动返回。支持微信滑动返回样式、横屏滑动返回、全屏滑动返回
Stars: ✭ 2,251 (+7161.29%)
Mutual labels:  androidx
Logcat
这是一个Android 上 效率极高的 Log 工具,主要功能为控制不同级别的Log输出,Log信息保存到文件、打印行号、函数调用、Json解析、点击跳转、多标签Tag 支持无限长字符串打印,无Logcat4000字符限制等功能
Stars: ✭ 90 (+190.32%)
Mutual labels:  logcat
StreamingAndroidLogger
Logger
Stars: ✭ 43 (+38.71%)
Mutual labels:  logcat
pixel
A lightweight image loader for Android backed by Kotlin Coroutines.
Stars: ✭ 79 (+154.84%)
Mutual labels:  androidx
LogDelegate
Simple, pretty and powerful logger for android
Stars: ✭ 287 (+825.81%)
Mutual labels:  logcat

MyLog - Library

Simple android logger (2020)

Java version: Download

Kotlin version: Download

Android Arsenal License

Medium article about this library

https://bit.ly/2Noc2SO

Installation

  • Add the dependency from jCenter to your app's (not project) build.gradle file:
repositories {
    jcenter()
}

dependencies {
    implementation 'net.alexandroid.utils:mylogkt:1.13'
}
  • Consider adding following proguard rule:
# Remove all log* methods from prpject
-assumenosideeffects class net.alexandroid.utils.mylogkt.MyLogKtKt { *; }
# Remove specific logger methods
-assumenosideeffects class net.alexandroid.utils.mylogkt.MyLogKtKt {
    public static *** logD$default(...);
    public static *** logW$default(...);
}
  • Next (All the settings below are optional):
public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        
        // Kotlin from Kotlin (Optional, to allow isPackageNameVisible = true)
        MyLogKt.packageName = packageName
        MyLogKt.isLogsShown = BuildConfig.DEBUG
        MyLogKt.tag = "STATIC CUSTOM TAG"

        // Other Kotlin version configurations
        MyLogKt.packageName = ""
        MyLogKt.isLogsShown = true
        MyLogKt.isThreadNameVisible = false
        MyLogKt.isTimeVisible = true
        MyLogKt.isPackageNameVisible = false
        MyLogKt.isClassNameVisible = true
        MyLogKt.isMethodNameVisible = true
        MyLogKt.isLengthShouldWrap = true

        MyLogKt.classNameLength = 15
        MyLogKt.packageAndClassNameLength = 35
        MyLogKt.methodNameLength = 15
        MyLogKt.threadNameLength = 6
        MyLogKt.timeFormat = "HH:mm:ss.SSS"
    }
}
  • Also don't forget to add: android:name=".MyApplication" at your application tag in AndroidManifest.xml
 <application
        android:name=".MyApplication"
        ...>

How I use it

    logD("Empty 1")
    logI("Empty 2")
    logW("Empty 3")
    logE("Empty 4")
    logV("Empty 5")

   // Same functions
    debug("Empty 1")
    info("Empty 2")
    warn("Empty 3")
    error("Empty 4")
    verbose("Empty 5")

    logD("Custom tag example 1", "CustomTag1")

    logE("Show Exception", t = NullPointerException())
}

Release notes

  • 1.13(kotlin version) - Added "debug, info, warn, error, verbose" functions
  • 1.12(kotlin version) - Allow more configurations
  • 1.11(kotlin version) - Refactoring, classes/methods wrapping
  • 1.9 (kotlin version) - Allow logging functions to be empty
  • 1.8 (kotlin version) - Remove init, thread name instead of tread id
  • 1.7 (kotlin version) - Koltin library bug fixes
  • 1.5 - Bug fix + Kotlin version
  • 1.4 - Custom tag support
  • 1.3 - AndroidX migration, Target 29
  • 1.2 - Add MyLog.e(String msg, Throwable t) - (by @davidHarush), 2 new constructors

Stage 1 - Remove logcat headers

Usualy logs look like below:

First go to Configure Logcat Header:

Uncheck all options and press OK:

Now your logs looks like below:

Stage 2 - Customize logs color scheme

File -> Settings -> Editor -> Colors & Fonts -> Android Logcat

Stage 3 - Library customization

Default:

MyLog.setPackageNameVisibility(true); 
MyLogKt.isPackageNameVisible = true

MyLog.setIsTimeVisible(false);
MyLogKt.isTimeVisible = false

MyLog.setThreadIdVisibility(true); 
MyLogKt.isThreadIdVisible = true




License

Copyright 2017 Alexey Korolev

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.

Deprecated - Java version => Installation

  • Add the dependency from jCenter to your app's (not project) build.gradle file:
repositories {
    jcenter()
}

dependencies {
    implementation 'net.alexandroid.utils:mylog:1.5'
}
  • Next:
public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        
        // Java (Mandatory)
        MyLog.init(this, "MyLog", BuildConfig.DEBUG); // Context,  Tag,   Show logs?
    }
}

How I use it

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    
    // Java lib
    MyLog.setTag("STATIC CUSTOM TAG");
    MyLog.d("Empty 1");
    MyLog.i("Empty 2");
    MyLog.w("Empty 3");
    MyLog.e("Empty 4");

    MyLog.d("CustomTag", "Custom tag example message");

    MyLog.e("Show Exception", new NullPointerException());
}
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].