adb logcat, only display custom log events?

Multi tool use
Multi tool use


adb logcat, only display custom log events?



I'm using adb logcat -s Unity to view log output from my Android build. However, I'm getting lots of stuff that I don't always need:


adb logcat -s Unity


08-10 15:53:25.956 17278 17297 D Unity : Sensor : Accelerometer ( 1) ; 0.002394 / 0.00s ; BMI160 accelerometer / Bosch
08-10 15:53:25.960 17278 17297 D Unity : Choreographer available: Enabling VSYNC timing
08-10 15:53:26.133 17278 17297 I Unity : Launching UI...
08-10 15:53:26.133 17278 17297 I Unity : UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
08-10 15:53:26.133 17278 17297 I Unity : UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object)
08-10 15:53:26.133 17278 17297 I Unity : UnityEngine.Logger:Log(LogType, Object)
08-10 15:53:26.133 17278 17297 I Unity : UnityEngine.Debug:Log(Object)



Is there a way to only get messages I intentionally output, ie "Launching UI..." above?



Currently I'm using Debug.Log() to output these messages.


Debug.Log()





developer.android.com/studio/command-line/… or just piping output through grep
– Morrison Chang
Aug 10 '17 at 21:17





I tried adb logcat Unity:I but it still showed events with E and D. Even so, many of the examples I want filtered above are the same category as the one line I don't want filtered (I).
– Scott Beeson
Aug 10 '17 at 21:21


adb logcat Unity:I




1 Answer
1



You can prefix every log message you send.


Debug.Log("<my-prefix> Hello World");



And then, on linux:


adb logcat | grep '<my-prefix>'



Or on Windows:


adb logcat | find "<my-prefix>"



You can also make your own log method to automatically prefix your log message.



EDIT



Using the -e option of logcat you can get the same behavior:


adb logcat -e <my-prefix>





This will work. Thank you.
– Scott Beeson
Aug 10 '17 at 21:28





I think on Windows double quotation mark should be used on the parameter of find. (i.e. adb logcat | find "<my-prefix>")
– Bahman_Aries
May 21 at 17:39


adb logcat | find "<my-prefix>"





@Bahman_Aries answer edited, thanks.
– Kevin Struillou
Jun 6 at 21:06






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

shHzkarsp8mecc4ZT Z5VS0qeDaLpHlFYGwTjqDJ3 dw0xA,Zm1tgd tZpWRS2 QcgbphtEBuZ,Qyfi2O,M,kfX3eSEVCaV,B
f4 rMzMfS4L

Popular posts from this blog

Rothschild family

Cinema of Italy