All Projects → HiJesse → Android-NativeLogger

HiJesse / Android-NativeLogger

Licence: other
Android Logger

Programming Languages

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

Projects that are alternatives of or similar to Android-NativeLogger

WormholyForObjectiveC
Network debugging made easy,This network debugging tool is developed based on the swift version of Wormholy.
Stars: ✭ 21 (+0%)
Mutual labels:  logger
lines-logger
Browser logger that rests lines in peace
Stars: ✭ 26 (+23.81%)
Mutual labels:  logger
G-Earth
Cross-platform Habbo packet manipulator
Stars: ✭ 52 (+147.62%)
Mutual labels:  logger
loggers
Abstract logging for Golang projects. A kind of log4go in the spirit of log4j
Stars: ✭ 17 (-19.05%)
Mutual labels:  logger
perforce-commit-discord-bot
🗒️ ✏️Posts the most recent commit messages from a Perforce version control server to a Discord channel.
Stars: ✭ 22 (+4.76%)
Mutual labels:  logger
DRF-API-Logger
An API Logger for your Django Rest Framework project.
Stars: ✭ 184 (+776.19%)
Mutual labels:  logger
junit.testlogger
JUnit test logger for vstest platform
Stars: ✭ 61 (+190.48%)
Mutual labels:  logger
QLogger
Multi-threading logger for Qt applications
Stars: ✭ 46 (+119.05%)
Mutual labels:  logger
logback-access-spring-boot-starter
Spring Boot Starter for Logback-access.
Stars: ✭ 153 (+628.57%)
Mutual labels:  logger
spdlog-python
python wrapper around C++ spdlog ([email protected]:gabime/spdlog.git)
Stars: ✭ 46 (+119.05%)
Mutual labels:  logger
ets2-job-logger
ETS2 Job Logger
Stars: ✭ 15 (-28.57%)
Mutual labels:  logger
LogDNA-Android-Client
Android client for LogDNA
Stars: ✭ 22 (+4.76%)
Mutual labels:  logger
logops
Really simple and performant logger for node projects compatible with any kind of deployments as your server operations/environment defined
Stars: ✭ 20 (-4.76%)
Mutual labels:  logger
l
Golang Pretty Logger
Stars: ✭ 51 (+142.86%)
Mutual labels:  logger
ng2-logger
Isomorphic logger for Browser and NodeJS, ( typescript / javascript ) apps
Stars: ✭ 61 (+190.48%)
Mutual labels:  logger
Torch-Scope
A Toolkit for Training, Tracking, Saving Models and Syncing Results
Stars: ✭ 62 (+195.24%)
Mutual labels:  logger
JJSwiftLog
Swift log library for all platform
Stars: ✭ 51 (+142.86%)
Mutual labels:  logger
RxLogs
An Android & Kotlin Reactive Advanced Logging Framework.
Stars: ✭ 12 (-42.86%)
Mutual labels:  logger
phoenix passwordless login
Phoenix Passwordless Login
Stars: ✭ 28 (+33.33%)
Mutual labels:  logger
wlog
A simple logging interface that supports cross-platform color and concurrency.
Stars: ✭ 59 (+180.95%)
Mutual labels:  logger

Android-NativeLogger

NativeLogger是Android平台一套日志管理框架.NativeLogger可以帮助开发者统一管理不同Level的log, 将其输出到Console或者文件(/天)中.后续将继续完善.

功能清单

状态 功能 默认
注解配置 支持
设置TAG NLogger
设置LEVEL WARN
是否捕获全局异常 false
是否开启文件日志 true
文件日志内容格式 SimpleFormatter
日志文件存放路径 /sdcard/native.logs/
日志文件过期时间 1 day
日志文件打包周期 1 day
格式化输出JSON 支持
日志混淆 -

: 已完成 : 待完成

Gradle引入

根项目build.gradle中引入mavenCentral.

allprojects {
    repositories {
        ...
        mavenCentral()
    }
}

Modulebuild.gradle中引入NLogger.

dependencies {
    compile 'com.github.hijesse:android-logger:2.5.0'
}

如何使用

  • 初始化-注解配置

    Java调用参考

    Kotlin调用示例:

     @Logger(tag = "Test", level = LoggerLevel.INFO)
     class MyApplication : Application() {
     
         override fun onCreate() {
             super.onCreate()
             // 使用注解方式初始化
             NLoggerConfig.init(this)
         }
     }
    
  • 初始化-全量配置

    Java调用参考

    Kotlin调用示例:

     NLoggerConfig.getInstance()
             .builder()
             .tag("APP")
             .loggerLevel(LoggerLevel.DEBUG)
             .fileLogger(true)
             .fileDirectory(applicationContext.filesDir.path + "/logs")
             .fileFormatter(SimpleFormatter())
             .expiredPeriod(3)
             .catchException(true, { _, ex ->
                 NLogger.e("uncaughtException", ex!!)
                 android.os.Process.killProcess(android.os.Process.myPid())
             })
             .build()
     	
    
  • 日志打印

    Kotlin和Java的调用完全一致.

     NLogger.d("debug");
     NLogger.i("MainActivity", "type1");
     NLogger.w("MainActivity", "%s", "type2");
     NLogger.d("MainActivity", "%s%d%s", "type", 3, "finish");
     NLogger.e("uncaughtException", throwable);
     NLogger.json(LoggerLevel.INFO, "{...}");
    
  • 日志压缩

    假设配置了日志文件打包周期为3天, 调用压缩日志后组件会压缩最近三天的日志到压缩包, 并回调到业务中. 压缩结果回调为子线程.

    Java调用参考

    Kotlin调用示例:

     NLogger.zipLogs { succeed, target ->
         if (succeed) {
             NLogger.i("zip", "succeed : $target Thread: ${Thread.currentThread().name}")
         }
     }
    
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].