zj565061763/log


Android log library

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.zj565061763:log:2.0.0-alpha02'
	}
	dependencies {
		implementation("com.github.zj565061763:log:2.0.0-alpha02")
	}
	<dependency>
	    <groupId>com.github.zj565061763</groupId>
	    <artifactId>log</artifactId>
	    <version>2.0.0-alpha02</version>
	</dependency>

                            
    libraryDependencies += "com.github.zj565061763" % "log" % "2.0.0-alpha02"
        
        

                            
    :dependencies [[com.github.zj565061763/log "2.0.0-alpha02"]]
        
        

Readme


Deprecated

这个库已经废弃不再维护,建议迁移到xlog

Gradle

Sample

class AppLogger : FLogger() {
    override fun onCreate() {
        // 开启日志文件,限制最大50MB
        openLogFile(50)
    }
}
class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        // 传统写法
        FLogger.get(AppLogger::class.java).info("info")

        // Kotlin写法
        flogD<AppLogger> { "debug" }
        flogI<AppLogger> { "info" }
        flogW<AppLogger> { "warning" }
        flogE<AppLogger> { "error" }
    }

    override fun onDestroy() {
        super.onDestroy()
        // 删除日志文件
        FLogger.deleteLogFile()
    }
}