#Suyghur 4 лет назад
Родитель
Сommit
b9a994ca1c
27 измененных файлов с 177 добавлено и 27 удалено
  1. 1 1
      demo/build.gradle
  2. 11 0
      demo/src/main/java/com/suyghur/dolin/simple/Test.java
  3. 0 0
      library_logger/.gitignore
  4. 0 0
      library_logger/CMakeLists.txt
  5. 1 0
      library_logger/build.gradle
  6. 0 0
      library_logger/consumer-rules.pro
  7. 0 0
      library_logger/proguard-rules.pro
  8. 0 0
      library_logger/src/main/AndroidManifest.xml
  9. 0 0
      library_logger/src/main/cpp/libs/buffer.cpp
  10. 0 0
      library_logger/src/main/cpp/libs/buffer.h
  11. 0 0
      library_logger/src/main/cpp/libs/buffer_flush.cpp
  12. 0 0
      library_logger/src/main/cpp/libs/buffer_flush.h
  13. 0 0
      library_logger/src/main/cpp/libs/buffer_header.cpp
  14. 0 0
      library_logger/src/main/cpp/libs/buffer_header.h
  15. 0 0
      library_logger/src/main/cpp/libs/file_flush.cpp
  16. 0 0
      library_logger/src/main/cpp/libs/file_flush.h
  17. 1 1
      library_logger/src/main/cpp/logger.cpp
  18. 8 0
      library_logger/src/main/java/com/suyghur/dolin/logger/Config.kt
  19. 16 0
      library_logger/src/main/java/com/suyghur/dolin/logger/Level.kt
  20. 9 0
      library_logger/src/main/java/com/suyghur/dolin/logger/Logger.kt
  21. 12 0
      library_logger/src/main/java/com/suyghur/dolin/logger/Version.kt
  22. 82 0
      library_logger/src/main/java/com/suyghur/dolin/logger/impl/LoggerImpl.kt
  23. 3 1
      library_logger/src/main/java/com/suyghur/dolin/logger/impl/RecordImpl.kt
  24. 31 0
      library_logger/src/main/java/com/suyghur/dolin/logger/internal/ILogger.kt
  25. 1 1
      library_logger/src/main/java/com/suyghur/dolin/logger/internal/IRecord.kt
  26. 0 22
      library_logkit/src/main/java/com/suyghur/dolin/logkit/LogKit.kt
  27. 1 1
      settings.gradle

+ 1 - 1
demo/build.gradle

@@ -73,5 +73,5 @@ android {
 
 dependencies {
 //    implementation project(':library_caps')
-    implementation project(':library_logkit')
+    implementation project(':library_logger')
 }

+ 11 - 0
demo/src/main/java/com/suyghur/dolin/simple/Test.java

@@ -0,0 +1,11 @@
+package com.suyghur.dolin.simple;
+
+/**
+ * @author #Suyghur.
+ * Created on 4/7/21
+ */
+public class Test {
+
+//    Logger.Config
+
+}

+ 0 - 0
library_logkit/.gitignore → library_logger/.gitignore


+ 0 - 0
library_logkit/CMakeLists.txt → library_logger/CMakeLists.txt


+ 1 - 0
library_logkit/build.gradle → library_logger/build.gradle

@@ -53,4 +53,5 @@ android {
 
 dependencies {
     implementation "org.jetbrains.kotlin:kotlin-stdlib:$KOTLIN_VERSION"
+    implementation 'androidx.core:core-ktx:1.3.2'
 }

+ 0 - 0
library_logkit/consumer-rules.pro → library_logger/consumer-rules.pro


+ 0 - 0
library_logkit/proguard-rules.pro → library_logger/proguard-rules.pro


+ 0 - 0
library_logkit/src/main/AndroidManifest.xml → library_logger/src/main/AndroidManifest.xml


+ 0 - 0
library_logkit/src/main/cpp/libs/buffer.cpp → library_logger/src/main/cpp/libs/buffer.cpp


+ 0 - 0
library_logkit/src/main/cpp/libs/buffer.h → library_logger/src/main/cpp/libs/buffer.h


+ 0 - 0
library_logkit/src/main/cpp/libs/buffer_flush.cpp → library_logger/src/main/cpp/libs/buffer_flush.cpp


+ 0 - 0
library_logkit/src/main/cpp/libs/buffer_flush.h → library_logger/src/main/cpp/libs/buffer_flush.h


+ 0 - 0
library_logkit/src/main/cpp/libs/buffer_header.cpp → library_logger/src/main/cpp/libs/buffer_header.cpp


+ 0 - 0
library_logkit/src/main/cpp/libs/buffer_header.h → library_logger/src/main/cpp/libs/buffer_header.h


+ 0 - 0
library_logkit/src/main/cpp/libs/file_flush.cpp → library_logger/src/main/cpp/libs/file_flush.cpp


+ 0 - 0
library_logkit/src/main/cpp/libs/file_flush.h → library_logger/src/main/cpp/libs/file_flush.h


+ 1 - 1
library_logkit/src/main/cpp/logkit.cpp → library_logger/src/main/cpp/logger.cpp

@@ -133,7 +133,7 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
     if (vm->GetEnv((void **) &env, JNI_VERSION_1_6) != JNI_OK) {
         return JNI_ERR;
     }
-    jclass clz = env->FindClass("com/suyghur/dolin/logkit/record/RecordImpl");
+    jclass clz = env->FindClass("com/suyghur/dolin/logger/record/RecordImpl");
     if (env->RegisterNatives(clz, gMethods, sizeof(gMethods) / sizeof(gMethods[0])) < 0) {
         return JNI_ERR;
     }

+ 8 - 0
library_logger/src/main/java/com/suyghur/dolin/logger/Config.kt

@@ -0,0 +1,8 @@
+package com.suyghur.dolin.logger
+
+/**
+ * @author #Suyghur.
+ * Created on 4/7/21
+ */
+class Config {
+}

+ 16 - 0
library_logger/src/main/java/com/suyghur/dolin/logger/Level.kt

@@ -0,0 +1,16 @@
+package com.suyghur.dolin.logger
+
+/**
+ * @author #Suyghur.
+ * Created on 4/7/21
+ */
+object Level {
+    const val ALL = -1
+    const val VERBOSE = 0
+    const val DEBUG = 1
+    const val INFO = 2
+    const val WARNING = 3
+    const val ERROR = 4
+}
+
+

+ 9 - 0
library_logger/src/main/java/com/suyghur/dolin/logger/Logger.kt

@@ -0,0 +1,9 @@
+package com.suyghur.dolin.logger
+
+/**
+ * @author #Suyghur.
+ * Created on 4/7/21
+ */
+object Logger {
+
+}

+ 12 - 0
library_logger/src/main/java/com/suyghur/dolin/logger/Version.kt

@@ -0,0 +1,12 @@
+package com.suyghur.dolin.logger
+
+/**
+ * @author #Suyghur.
+ * Created on 4/7/21
+ */
+object Version {
+
+    const val VERSION_NAME = "1.0.0"
+
+    const val VERSION_CODE = 100
+}

+ 82 - 0
library_logger/src/main/java/com/suyghur/dolin/logger/impl/LoggerImpl.kt

@@ -0,0 +1,82 @@
+package com.suyghur.dolin.logger.impl
+
+import androidx.annotation.Keep
+import com.suyghur.dolin.logger.Config
+import com.suyghur.dolin.logger.internal.ILogger
+
+/**
+ * @author #Suyghur.
+ * Created on 4/7/21
+ */
+class LoggerImpl : ILogger {
+
+    private var hasInitialized: Boolean = false
+    private var config: Config? = null
+
+    fun initialize(config: Config) {
+        if (hasInitialized) {
+            throw IllegalArgumentException("Logger already initialize")
+        }
+        this.config = config
+
+    }
+
+    override fun v(tag: String, msg: String, vararg args: Any) {
+        TODO("Not yet implemented")
+    }
+
+    override fun d(tag: String, msg: String, vararg args: Any) {
+        TODO("Not yet implemented")
+    }
+
+    override fun d(tag: String, any: Any) {
+        TODO("Not yet implemented")
+    }
+
+    override fun i(tag: String, msg: String, vararg args: Any) {
+        TODO("Not yet implemented")
+    }
+
+    override fun w(tag: String, msg: String, vararg args: Any) {
+        TODO("Not yet implemented")
+    }
+
+    override fun e(tag: String, msg: String, vararg args: Any) {
+        TODO("Not yet implemented")
+    }
+
+    override fun e(throwable: Throwable, tag: String, msg: String, vararg args: Any) {
+        TODO("Not yet implemented")
+    }
+
+    override fun record(level: Int, tag: String, msg: String) {
+        TODO("Not yet implemented")
+    }
+
+    override fun print(tag: String, msg: String, vararg args: Any) {
+        TODO("Not yet implemented")
+    }
+
+    override fun print(tag: String, any: Any) {
+        TODO("Not yet implemented")
+    }
+
+    override fun print(level: Int, tag: String, msg: String) {
+        TODO("Not yet implemented")
+    }
+
+    companion object {
+
+        @Keep
+        @JvmStatic
+        fun getInstance(): LoggerImpl {
+            return LoggerImplHolder.INSTANCE
+        }
+
+        private object LoggerImplHolder {
+            val INSTANCE = LoggerImpl()
+        }
+    }
+
+
+}

+ 3 - 1
library_logkit/src/main/java/com/suyghur/dolin/logkit/record/RecordImpl.kt → library_logger/src/main/java/com/suyghur/dolin/logger/impl/RecordImpl.kt

@@ -1,4 +1,6 @@
-package com.suyghur.dolin.logkit.record
+package com.suyghur.dolin.logger.impl
+
+import com.suyghur.dolin.logger.internal.IRecord
 
 /**
  * @author #Suyghur.

+ 31 - 0
library_logger/src/main/java/com/suyghur/dolin/logger/internal/ILogger.kt

@@ -0,0 +1,31 @@
+package com.suyghur.dolin.logger.internal
+
+/**
+ * @author #Suyghur.
+ * Created on 4/7/21
+ */
+interface ILogger {
+
+    fun v(tag: String, msg: String, vararg args: Any)
+
+    fun d(tag: String, msg: String, vararg args: Any)
+
+    fun d(tag: String, any: Any)
+
+    fun i(tag: String, msg: String, vararg args: Any)
+
+    fun w(tag: String, msg: String, vararg args: Any)
+
+    fun e(tag: String, msg: String, vararg args: Any)
+
+    fun e(throwable: Throwable, tag: String, msg: String, vararg args: Any)
+
+    fun record(level: Int, tag: String, msg: String)
+
+    fun print(tag: String, msg: String, vararg args: Any)
+
+    fun print(tag: String, any: Any)
+
+    fun print(level: Int, tag: String, msg: String)
+
+}

+ 1 - 1
library_logkit/src/main/java/com/suyghur/dolin/logkit/record/IRecord.kt → library_logger/src/main/java/com/suyghur/dolin/logger/internal/IRecord.kt

@@ -1,4 +1,4 @@
-package com.suyghur.dolin.logkit.record
+package com.suyghur.dolin.logger.internal
 
 /**
  * @author #Suyghur.

+ 0 - 22
library_logkit/src/main/java/com/suyghur/dolin/logkit/LogKit.kt

@@ -1,22 +0,0 @@
-package com.suyghur.dolin.logkit
-
-/**
- * @author #Suyghur.
- * Created on 4/7/21
- */
-class LogKit {
-
-//    private var ptr = 0L
-
-//    init {
-//        System.loadLibrary("logkit")
-//        try {
-//            ptr = initNative()
-//        } catch (e: Exception) {
-//            e.printStackTrace()
-//        }
-//    }
-
-
-//    private external fun initNative(bufferPath: String, capacity: Int, logPath: String, compress: Boolean): Long
-}

+ 1 - 1
settings.gradle

@@ -1,4 +1,4 @@
 include ':demo'
 //include ':library_caps'
-include ':library_logkit'
+include ':library_logger'
 rootProject.name = 'Dolin'