Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebView: Use timber for logging #323

Merged
merged 1 commit into from
Mar 24, 2021

Conversation

Codex-
Copy link
Contributor

@Codex- Codex- commented Mar 20, 2021

I found during my last PR that all logs despite the level used in the JS layer would always go to the info level when logged in logcat.

This change simply overrides the onConsoleMessage method to log messages to the correct level.

This allows you to use the logcat filtering in IntelliJ/Android Studio to filter for logs normally and makes the messages less verbose.

The new messages are tagged with WebView and follow the original messages format, although happy to change any of this :)

Old:

2021-03-21 01:25:37.501 7245-7245/org.jellyfin.mobile.debug I/chromium: [INFO:CONSOLE(1)] "nowplaying event: init", source: http://192.168.0.100:8096/web/1372.2199cd4f8b32083a01bb.bundle.js (1)
2021-03-21 01:25:37.501 7245-7245/org.jellyfin.mobile.debug I/chromium: [INFO:CONSOLE(1)] "null", source: http://192.168.0.100:8096/web/chromecastPlayer-plugin.3b1e613c5d041153b04a.bundle.js (1)
2021-03-21 01:25:37.543 7245-7245/org.jellyfin.mobile.debug I/chromium: [INFO:CONSOLE(1444)] "Encountered cast error [object Object]", source: https://www.gstatic.com/cv/js/sender/v1/cast_sender.js (1444)
2021-03-21 01:25:37.544 7245-7245/org.jellyfin.mobile.debug I/chromium: [INFO:CONSOLE(1)] "chromecast error", source: http://192.168.0.100:8096/web/chromecastPlayer-plugin.3b1e613c5d041153b04a.bundle.js (1)
2021-03-21 01:25:53.225 7245-7245/org.jellyfin.mobile.debug I/chromium: [INFO:CONSOLE(2)] "Sending web socket message: KeepAlive", source: http://192.168.0.100:8096/web/main.3309837d9db1402ea3a1.bundle.js (2)
2021-03-21 01:25:53.235 7245-7245/org.jellyfin.mobile.debug I/chromium: [INFO:CONSOLE(2)] "Received KeepAlive from server.", source: http://192.168.0.100:8096/web/main.3309837d9db1402ea3a1.bundle.js (2)
2021-03-21 01:26:23.216 7245-7245/org.jellyfin.mobile.debug I/chromium: [INFO:CONSOLE(2)] "Sending web socket message: KeepAlive", source: http://192.168.0.100:8096/web/main.3309837d9db1402ea3a1.bundle.js (2)

New:

2021-03-21 01:49:02.246 14116-14116/org.jellyfin.mobile.debug V/WebView: SyncPlay WrapperFactory getWrapper: chromecast, http://192.168.0.100:8096/web/main.3309837d9db1402ea3a1.bundle.js (2)
2021-03-21 01:49:02.246 14116-14116/org.jellyfin.mobile.debug V/WebView: SyncPlay WrapperFactory getWrapper: unknown player chromecast, using default wrapper., http://192.168.0.100:8096/web/main.3309837d9db1402ea3a1.bundle.js (2)
2021-03-21 01:49:02.247 14116-14116/org.jellyfin.mobile.debug V/WebView: null, http://192.168.0.100:8096/web/chromecastPlayer-plugin.3b1e613c5d041153b04a.bundle.js (1)
2021-03-21 01:49:02.248 14116-14116/org.jellyfin.mobile.debug V/WebView: nowplaying event: init, http://192.168.0.100:8096/web/1372.2199cd4f8b32083a01bb.bundle.js (1)
2021-03-21 01:49:02.248 14116-14116/org.jellyfin.mobile.debug V/WebView: null, http://192.168.0.100:8096/web/chromecastPlayer-plugin.3b1e613c5d041153b04a.bundle.js (1)
2021-03-21 01:49:02.274 14116-14116/org.jellyfin.mobile.debug E/WebView: Encountered cast error [object Object], https://www.gstatic.com/cv/js/sender/v1/cast_sender.js (1434)
2021-03-21 01:49:02.274 14116-14116/org.jellyfin.mobile.debug V/WebView: chromecast error, http://192.168.0.100:8096/web/chromecastPlayer-plugin.3b1e613c5d041153b04a.bundle.js (1)
2021-03-21 01:49:21.101 14116-14116/org.jellyfin.mobile.debug I/WebView: Sending web socket message: KeepAlive, http://192.168.0.100:8096/web/main.3309837d9db1402ea3a1.bundle.js (2)
2021-03-21 01:49:21.122 14116-14116/org.jellyfin.mobile.debug V/WebView: Received KeepAlive from server., http://192.168.0.100:8096/web/main.3309837d9db1402ea3a1.bundle.js (2)

@Codex- Codex- force-pushed the feature/webview_timber_logging branch from 945ab95 to 2ee6cba Compare March 20, 2021 14:30
@Codex- Codex- force-pushed the feature/webview_timber_logging branch from 2ee6cba to 9581573 Compare March 20, 2021 23:07
@Codex-
Copy link
Contributor Author

Codex- commented Mar 21, 2021

Not sure what's happening with the agent:

R8: Missing class: org.conscrypt.ConscryptHostnameVerifier
Writing [v0.0.0-dev.1=1] to /home/vsts/work/1/s/app/build/version.txt
w: /home/vsts/work/1/s/app/src/main/java/org/jellyfin/mobile/bridge/NativeInterface.kt: (99, 30): Parameter 'target' is never used
Note: /home/vsts/work/1/s/app/src/proprietary/java/org/jellyfin/mobile/cast/ChromecastConnection.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
R8: Missing class: org.conscrypt.ConscryptHostnameVerifier

@Maxr1998
Copy link
Member

Those messages should be fine. Azure just randomly crashes occasionally, restarted the pipeline so it hopefully passes now.

@Maxr1998 Maxr1998 changed the title WebView: Use timber for logging. WebView: Use timber for logging Mar 21, 2021
nielsvanvelzen
nielsvanvelzen previously approved these changes Mar 22, 2021
@github-actions github-actions bot added the merge conflict Conflicts prevent merging label Mar 23, 2021
@Codex- Codex- force-pushed the feature/webview_timber_logging branch from 9581573 to 5c56c23 Compare March 24, 2021 00:59
@Codex- Codex- force-pushed the feature/webview_timber_logging branch from 5c56c23 to 6387bf4 Compare March 24, 2021 01:06
@Codex-
Copy link
Contributor Author

Codex- commented Mar 24, 2021

Rebased and resolved conflicts.

@nielsvanvelzen nielsvanvelzen added this to In progress in v2.3.0 via automation Mar 24, 2021
@nielsvanvelzen nielsvanvelzen removed the merge conflict Conflicts prevent merging label Mar 24, 2021
@Maxr1998 Maxr1998 merged commit e2f134c into jellyfin:master Mar 24, 2021
v2.3.0 automation moved this from In progress to Done Mar 24, 2021
@Codex- Codex- deleted the feature/webview_timber_logging branch March 24, 2021 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants