Recent

Author Topic: [SOLVED] Output messages to android system log (logcat)?  (Read 2294 times)

WayneSherman

  • Full Member
  • ***
  • Posts: 243
[SOLVED] Output messages to android system log (logcat)?
« on: June 07, 2018, 05:35:51 pm »
I would like to use logcat for debugging.  How can I output text to the android system log?

Thanks.
« Last Edit: June 07, 2018, 06:50:57 pm by WayneSherman »

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1739
Re: Output messages to android system log (logcat)?
« Reply #1 on: June 07, 2018, 05:50:32 pm »
Code: Pascal  [Select][+][-]
  1. const
  2.       ANDROID_LOG_UNKNOWN=0;
  3.       ANDROID_LOG_DEFAULT=1;
  4.       ANDROID_LOG_VERBOSE=2;
  5.       ANDROID_LOG_DEBUG=3;
  6.       ANDROID_LOG_INFO=4;
  7.       ANDROID_LOG_WARN=5;
  8.       ANDROID_LOG_ERROR=6;
  9.       ANDROID_LOG_FATAL=7;
  10.       ANDROID_LOG_SILENT=8;
  11.  
  12. function log(prio:cint;tag,text:PAnsiChar):cint; cdecl; external 'liblog.so' name '__android_log_write';
  13.  
  14. Use:
  15. log(ANDROID_LOG_VERBOSE,'MyTag','MyMessage');
  16.  

WayneSherman

  • Full Member
  • ***
  • Posts: 243
Re: Output messages to android system log (logcat)?
« Reply #2 on: June 07, 2018, 06:50:18 pm »
Thank you sir.  Based on your answer I found the system log call for android defined in two places:

LAMW: .../lazandroidmodulewizard/android_bridges/And_log_h.pas

  See also example code for LAMW log:
    (near bottom of file:  "3.1.1. File 1 - "And_log_h.pas" - the header interface file")
    .../lazandroidmodulewizard/readme.md
    .../lazandroidmodulewizard/docs/readme.txt

Lazarus Custom Drawn:  .../lazarus/lcl/interfaces/customdrawn/android/log.pas
« Last Edit: June 07, 2018, 08:03:23 pm by WayneSherman »

 

TinyPortal © 2005-2018