User Tools

Site Tools


doc:appunti:prog:kivy

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
doc:appunti:prog:kivy [2019/02/25 12:31] – [A Real App With an ActionBar] niccolodoc:appunti:prog:kivy [2023/10/07 21:53] (current) – [Logging] niccolo
Line 131: Line 131:
  
 {{.:kivy:kivywindowexample.png?direct&320|Kivy ActionBar Example}} {{.:kivy:kivywindowexample.png?direct&320|Kivy ActionBar Example}}
 +
 +
 +===== Logging =====
 +
 +Like a plain Python program, it is possible for a Kivy app to produce some logging using the Kivy logger. The output will go, by default, to a file created into the app home directory, into the **files/app/.kivy/logs/** directory.
 +
 +<code python>
 +from kivy.logger import Logger, LOG_LEVELS
 +# Set the loglevel. The Android log file will be create into
 +# [app_home]/files/app/.kivy/logs/
 +Logger.setLevel(LOG_LEVELS['debug'])
 +Logger.info('Informative message')
 +</code>
 +
 +Without root privileges it is not possibile for another Android app (e.g. a file browser) to access the log directory. The Kivy **app home** will be into the adopted SD card, under something like this:
 +
 +<code>
 +/mnt/expand/[UUID]/user/0/[fully.qualified.app.name]
 +</code>
 +
 +In older Android versions (e.g. Android 8) the app home directory will be something like:
 +
 +<code>
 +/data/data/[fully.qualified.app.name]
 +</code>
 +
 +Every time that the Kivy environment is initializated, a new log file will be created; the filename will be something like **kivy_YY-MM-DD_N.txt**, where YY-MM-DD is the date and N is a progressive integer starting from zero.
 +
 +
 +
doc/appunti/prog/kivy.1551094304.txt.gz · Last modified: 2019/02/25 12:31 by niccolo