-
Notifications
You must be signed in to change notification settings - Fork 464
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #107 from NordicSemiconductor/feature/logger
Add support for nRF Logger
- Loading branch information
Showing
38 changed files
with
212 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="1024dp" | ||
android:height="1024dp" | ||
android:viewportWidth="1024" | ||
android:viewportHeight="1024"> | ||
<path | ||
android:pathData="M989.6,949.6L772.8,732.8c30.8,-33.4 55.3,-71.5 73,-113.4c20.6,-48.7 31,-100.4 31,-153.6s-10.4,-105 -31,-153.6c-19.9,-47 -48.3,-89.2 -84.6,-125.4c-36.2,-36.2 -78.4,-64.7 -125.4,-84.6c-48.7,-20.6 -100.4,-31 -153.6,-31s-105,10.4 -153.6,31c-47,19.9 -89.2,48.3 -125.4,84.6c-36.2,36.2 -64.7,78.4 -84.6,125.4c-20.6,48.7 -31,100.4 -31,153.6s10.4,105 31,153.6c19.9,47 48.3,89.2 84.6,125.4c36.2,36.2 78.4,64.7 125.4,84.6c48.7,20.6 100.4,31 153.6,31s105,-10.4 153.6,-31c34.6,-14.6 66.6,-33.9 95.5,-57.5l218,218c5.6,5.6 12.9,8.3 20.2,8.3s14.6,-2.8 20.2,-8.3C1000.8,978.8 1000.8,960.7 989.6,949.6zM482.2,803.4c-112.7,0 -212.6,-55.5 -274,-140.6h352.3c15.7,0 28.5,-12.8 28.5,-28.5s-12.8,-28.5 -28.5,-28.5H175c-15.8,-34.5 -25.9,-72.1 -29.2,-111.6h414.8c15.7,0 28.5,-12.8 28.5,-28.5s-12.8,-28.5 -28.5,-28.5H145.7c3.3,-39.5 13.5,-77.1 29.2,-111.6h385.5c15.7,0 28.5,-12.8 28.5,-28.5s-12.8,-28.5 -28.5,-28.5H208.2c61.4,-85.1 161.3,-140.6 274,-140.6c186.2,0 337.7,151.5 337.7,337.7C819.9,651.9 668.4,803.4 482.2,803.4z" | ||
android:fillColor="#00B3DC"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apply from: rootProject.file("library.gradle") | ||
|
||
dependencies { | ||
implementation libs.nordic.log | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="no.nordicsemi.android.log"> | ||
|
||
<uses-permission android:name="no.nordicsemi.android.LOG"/> | ||
|
||
</manifest> |
28 changes: 28 additions & 0 deletions
28
lib_log/src/main/java/no/nordicsemi/android/log/ToolboxLogger.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package no.nordicsemi.android.log | ||
|
||
import android.content.Context | ||
import android.util.Log | ||
import no.nordicsemi.android.log.annotation.LogLevel | ||
|
||
internal const val LOG_TAG = "nRF Toolbox" | ||
|
||
class ToolboxLogger( | ||
private val context: Context, | ||
private val key: String, | ||
) { | ||
|
||
private var logSession: LogSession? = null | ||
|
||
fun log(@LogLevel level: Int, message: String) { | ||
val logSession = getLogger() | ||
if (logSession != null) { | ||
Logger.log(logSession, LogContract.Log.Level.fromPriority(level), message) | ||
} | ||
Log.println(level, LOG_TAG, message) | ||
} | ||
|
||
private fun getLogger(): LogSession? { | ||
logSession = logSession ?: Logger.newSession(context, key, LOG_TAG) | ||
return logSession | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.