Skip to content

Commit 5f4d162

Browse files
committed
Version 2.3.0
1 parent 9e4ff5b commit 5f4d162

File tree

2 files changed

+39
-17
lines changed

2 files changed

+39
-17
lines changed

README.md

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,29 @@
22

33
[ ![Download](https://api.bintray.com/packages/nordic/android/nrf-logger-api/images/download.svg) ](https://bintray.com/nordic/android/nrf-logger-api/_latestVersion)
44

5-
The library allows to easily create custom log entries from your application in the nRF Logger. It is being used by nRF Connect and nRF Toolbox, that are available on Google Play.
5+
The library allows to easily create custom log entries from your application in the
6+
[nRF Logger](https://play.google.com/store/apps/details?id=no.nordicsemi.android.log).
7+
It is being used by nRF Connect and nRF Toolbox, that are available on Google Play.
68
The logger may be used for debugging purposes, as LogCat is not always available.
79

8-
nRF Logger is available for Android 4.1.* and newer.
10+
nRF Logger is available for Android 4.2.* and newer.
911

1012
### Usage
11-
The nRF Logger API library is available as *jar* or from jcenter and Maven Central repositories. For Android Studio, add the following dependency to your component's *gradle.build* file:
13+
The nRF Logger API library is available on JCenter and Maven Central repositories.
14+
For Android Studio, add the following dependency to your component's *gradle.build* file:
1215

1316
```Groovy
14-
implementation 'no.nordicsemi.android:log:2.2.0'
17+
implementation 'no.nordicsemi.android:log:2.3.0'
1518
```
1619

1720
For easy integration with [Timber (4.7.1)](https://github.com/JakeWharton/timber), use this instead:
1821

1922
```Groovy
20-
implementation 'no.nordicsemi.android:log-timber:2.2.0'
23+
implementation 'no.nordicsemi.android:log-timber:2.3.0'
2124
```
2225

26+
If your project is NOT migrated to AndroidX, use version 2.2.0.
27+
2328
If you use proguard, the following line will be automatically added to your proguard rules:
2429

2530
```-keep class no.nordicsemi.android.log.** { *; }```
@@ -33,21 +38,26 @@ If you use proguard, the following line will be automatically added to your prog
3338
APPLICATION level added in version 2.0 of the library.
3439

3540
### Timber integration
36-
After importing log-timber dependency, plant the [nRFLoggerTree](https://github.com/NordicSemiconductor/nRF-Logger-API/blob/master/log-timber/src/main/java/no/nordicsemi/android/log/timber/nRFLoggerTree.java), as described on [Timber](https://github.com/JakeWharton/timber) website.
41+
After importing log-timber dependency, plant the
42+
[nRFLoggerTree](https://github.com/NordicSemiconductor/nRF-Logger-API/blob/master/log-timber/src/main/java/no/nordicsemi/android/log/timber/nRFLoggerTree.java),
43+
as described on [Timber](https://github.com/JakeWharton/timber) website.
3744

3845
#### Important
39-
1. The log-timber library uses *android.support.annotation:28.0.0* `@NonNull` and `@Nullable`, instead of ones from *org.jetbrains.annotations*, like Timber does.
40-
2. Log levels that Timber uses are incompatible with those in nRF Logger. In Timber, the APPLICATION level is missing, and DEBUG has higher priority then VERBOSE.
46+
1. The log-timber library uses `@NonNull` and `@Nullable` from *androidx.annotation*,
47+
instead of ones from *org.jetbrains.annotations*, like Timber does.
48+
2. Log levels that Timber uses are incompatible with those in nRF Logger.
49+
In Timber, the APPLICATION level is missing, and DEBUG has higher priority then VERBOSE.
4150
3. Using Timber's (e.g. `Timber.i(...)`) API it is not possible to log on APPLICATION level.
4251
4. Logs logged with `Log.VERBOSE` priority will get VERBOSE log level, so will be upgraded.
4352
5. Logs logged with `Log.DEBUG` priority will get DEBUG level, so will be downgraded.
4453
6. Tags will be added before the message: `[TAG] message`.
4554

4655
### Example
47-
The example project may be found in samples folder. It contains a simple application that shows how to create a log session:
56+
The example project may be found in samples folder. It contains a simple application that shows
57+
how to create a log session:
4858
```java
4959
logSession = Logger.newSession(context, key, name);
50-
```
60+
```
5161
and add entries:
5262
```java
5363
Logger.log(logSession, Level.INFO, text);
@@ -59,11 +69,14 @@ If nRF Logger application is not installed on the device those methods does noth
5969

6070
![Logger Image](.assets/logger2.png) ![Logger Image](.assets/logger1.png)
6171

62-
(1) When you create your first log session from your application its name will be added to nRF Logger drop-down menu.
72+
(1) When you create your first log session from your application its name will be added to nRF Logger
73+
drop-down menu.
6374
```java
6475
logSession = Logger.newSession(context, key, name);
6576
```
66-
(2) You may create multiple folders for different components of your application by creating a session with a profile name. It will be concatenated with the application name and visible as different entry in the drop-down menu.
77+
(2) You may create multiple folders for different components of your application by creating a session
78+
with a profile name. It will be concatenated with the application name and visible as different
79+
entry in the drop-down menu.
6780
```java
6881
logSession = Logger.newSession(context, "Profile Name", key, name);
6982
```
@@ -85,17 +98,26 @@ Logger.setSessionMark(logSession, Logger.MARK_FLAG_RED);
8598

8699
### Local Log Content Provider
87100

88-
The version 2.0 introduced the **LocalLogContentProvider** class which may be used to keep logs even if the nRF Logger application is not installed. Local log database is a limited version of the one in nRF Logger. It does not support multiple applications as the new provider is designed to work only in one application. Also marking session with a flag/star or adding a description is not supported.
101+
The version 2.0 introduced the **LocalLogContentProvider** class which may be used to keep logs even
102+
if the nRF Logger application is not installed. Local log database is a limited version of the one
103+
in nRF Logger. It does not support multiple applications as the new provider is designed to work only
104+
in one application. Also marking session with a flag/star or adding a description is not supported.
89105

90-
To use the LocalLogContentProvider you must extend extend this class in you project and add its definition to the *AndroidManifest.xml* file:
106+
To use the LocalLogContentProvider you must extend extend this class in you project and add its
107+
definition to the *AndroidManifest.xml* file:
91108
```xml
92109
<provider
93110
android:name="com.example.log.provider.MyLogContentProvider"
94111
android:authorities="com.example.log"
95112
android:exported="true" />
96113
```
97-
If you want to use the local logger in threads that are owned by other applications, f.e. by Bluetooth scanner callbacks, you must set the **exported** attribute to *true*. Otherwise the Bluetooth application will not have the permission to add log events. You may also use **Handler** object to log in UI thread of your application.
114+
If you want to use the local logger in threads that are owned by other applications, e.g. by Bluetooth
115+
scanner callbacks, you must set the **exported** attribute to *true*. Otherwise the Bluetooth application
116+
will not have the permission to add log events. You may also use **Handler** object to log in
117+
UI thread of your application.
98118

99119
### ILogSession
100120

101-
In order to make the LocalLogSession work a new interface has been created - **ILogSession**. Both **LogSession** and **LocalLogSession** implement this interface. You will need to change the type of your *mLogSession* object to **ILogSession** when migrating to version 2.0 of the library.
121+
In order to make the `LocalLogSession` work, a new interface has been created - `ILogSession`.
122+
Both `LogSession` and `LocalLogSession` implement this interface. You will need to change the
123+
type of your `mLogSession` object to `ILogSession` when migrating to version 2.0 of the library.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
android.useAndroidX=true
1818
android.enableJetifier=true
1919

20-
VERSION_NAME=2.2.0
20+
VERSION_NAME=2.3.0
2121
GROUP=no.nordicsemi.android
2222

2323
POM_DESCRIPTION=nRF Logger API Library

0 commit comments

Comments
 (0)