Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
05e71d11
Commit
05e71d11
authored
Jan 27, 2018
by
Lucio Maciel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HttpLoggingInterceptor to log to Timber
parent
cadc0ed5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
AppModule.kt
.../main/java/chat/rocket/android/dagger/module/AppModule.kt
+6
-2
No files found.
app/src/main/java/chat/rocket/android/dagger/module/AppModule.kt
View file @
05e71d11
...
@@ -38,6 +38,7 @@ import kotlinx.coroutines.experimental.Job
...
@@ -38,6 +38,7 @@ import kotlinx.coroutines.experimental.Job
import
okhttp3.Interceptor
import
okhttp3.Interceptor
import
okhttp3.OkHttpClient
import
okhttp3.OkHttpClient
import
okhttp3.logging.HttpLoggingInterceptor
import
okhttp3.logging.HttpLoggingInterceptor
import
timber.log.Timber
import
javax.inject.Singleton
import
javax.inject.Singleton
@Module
@Module
...
@@ -82,11 +83,14 @@ class AppModule {
...
@@ -82,11 +83,14 @@ class AppModule {
@Provides
@Provides
@Singleton
@Singleton
fun
provideHttpLoggingInterceptor
():
HttpLoggingInterceptor
{
fun
provideHttpLoggingInterceptor
():
HttpLoggingInterceptor
{
val
interceptor
=
HttpLoggingInterceptor
()
val
interceptor
=
HttpLoggingInterceptor
(
HttpLoggingInterceptor
.
Logger
{
message
->
Timber
.
d
(
message
)
})
if
(
BuildConfig
.
DEBUG
)
{
if
(
BuildConfig
.
DEBUG
)
{
interceptor
.
level
=
HttpLoggingInterceptor
.
Level
.
BODY
interceptor
.
level
=
HttpLoggingInterceptor
.
Level
.
BODY
}
else
{
}
else
{
interceptor
.
level
=
HttpLoggingInterceptor
.
Level
.
HEADERS
// TODO - change to HEADERS on production...
interceptor
.
level
=
HttpLoggingInterceptor
.
Level
.
BODY
}
}
return
interceptor
return
interceptor
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment