4 Log files
Peter Hutterer edited this page 2019-08-30 08:37:29 +10:00

Downloading drawings from a tablet is destructive - the drawings get deleted after a successful download. So we really want to make sure we don't screw things up and log as much as possible to recover the data if need be.

The default directory for all of Tuhi's data storage is $XDG_DATA_DIR/tuhi

  • for normal Tuhi invocations, that usually resolves to $HOME/.local/share/tuhi/.
  • for the Tuhi flatpak, this usually resolves to $HOME/.var/app/org.freedesktop.Tuhi

Inside are the various data files Tuhi uses.

An example for the files in that directory:

$ tree $XDG_DATA_DIR/tuhi
/home/username/.local/share/tuhi/
├── 1566523887.json                      # The json files used by the GUI
├── 1566523888.json.deleted              # A deleted drawing
├── 1566523990.json                      
├── DC:2C:26:A0:C9:A8
│   ├── 1566523887.json                  # cached by the tuhi server, these files
│   ├── 1566523887.json                  # may be removed at any time when the
│   ├── 1566523990.json                  # server decides to purge old files
│   ├── raw
│   │   ├── log-1566523792-2019-08-23-11:29:52.yaml   # raw data logs, never deleted
│   │   ├── log-1566523813-2019-08-23-11:30:13.yaml
│   │   ├── log-1566523880-2019-08-23-11:31:20.yaml
│   │   └── log-1566531491-2019-08-23-13:38:11.yaml
│   └── settings.ini                     # stores the device settings
└── session-logs                         # session logs, never deleted
    ├── tuhi-19-08-23-11:29:39.log
    ├── tuhi-19-08-23-11:30:49.log
    ├── tuhi-19-08-23-11:31:14.log
    ├── tuhi-19-08-23-13:17:59.log
    ├── tuhi-19-08-23-13:34:44.log
    └── tuhi-19-08-23-13:36:26.log

Session logs

The log output of a tuhi session is saved to $XDG_DATA_DIR/tuhi/session-logs with a timestamp as name. This is the equivalent of piping the commandline output into that log file.

Raw log files

Any communication between Tuhi and the device is logged as a YAML file in $XDG_DATA_DIR/tuhi/<bluetooth address>/raw/. The files are named after the time they were created, e.g. log-1565844084-2019-08-15-14:41:24.yaml, i.e. in the format log-$UNIX_TIMESTAMP-$HUMAN_READABLE_TIME.yaml.

These files contain one single interaction with the device, they are created whenever the device connects. Given that it's BLE, the device will disconnect after any check - every few seconds. Most of the files will not have any useful data in it, grep for PEN to search for files with Pen data.

The YAML format is not guaranteed to be stable, it is a backup only. The file format is not documented, it's self-descriptive.

JSON source files

Any converted drawing is stored as JSON file in $XDG_DATA_DIR/tuhi/<bluetooth address>/<timestamp>.json. These are the files that the Tuhi server will make available over DBus. There is no storage guarantee for those files, they may be deleted at any time. They exist primarily to make testing easier, so we can keep a few files around to verify the server part works as expected.

Converted SVG files

The Tuhi GUI converts JSON files into SVG files. These SVG files temporary files only, they are regenerated e.g. when the orientation changes. Storage for those is not permanent, they are stored in the XDG_CACHE_DIR, i.e. $XDG_CACHE_DIR/tuhi/svg/. Note that the GUI only handles one device, so there is no bluetooth address encoded here.