~aleteoryx/muditaos

16763ee2ef6becc6e085b02af105b307f430438d — Mateusz Grzegorzek 4 years ago 46b8914
[EGD-4593] Add Logging Engine docs

Add Logging Engine docs
3 files changed, 35 insertions(+), 2 deletions(-)

M README.md
A module-utils/log/doc/logging_engine.md
M tools/mount_user_lfs_partition.py
M README.md => README.md +1 -0
@@ 55,6 55,7 @@ You can quickstart the project by going through one of the following guides:
- [Super dirty quickstart with unit tests](./doc/quickstart.md#super-dirty-quickstart-with-unit-tests)
- [Super dirty quickstart on the phone](./doc/quickstart.md#super-dirty-quickstart-on-the-phone)
- [Preparing packages](./doc/quickstart.md#preparing-packages)
- [Logging engine](./module-utils/log/doc/logging_engine.md)

## Contributing


A module-utils/log/doc/logging_engine.md => module-utils/log/doc/logging_engine.md +32 -0
@@ 0,0 1,32 @@
# Logging engine

- [Logger](#Logger)
- [Dumping to a file](#Dumping-to-a-file)

## Logger

Logger class is used for sending `log messages` coming from LOG macros:

- `LOG_PRINTF`
- `LOG_TRACE`
- `LOG_DEBUG`
- `LOG_INFO`
- `LOG_WARN`
- `LOG_ERROR`
- `LOG_FATAL`
- `LOG_CUSTOM`

to a proper device (`SEGGER_RTT`, `console output`, `SYSTEMVIEW`)
and at the same time to put them to a `circular buffer`.

`Circular buffer` has a limited size which sometimes results in losing some logs.

In such a case, proper `lost message info` is added to `msg` received from the buffer.

## Dumping to a file

Logs from `Circular buffer` are dumped to a file named `MuditaOS.log` every 10 sec by `EventManager` timer.

Current max log file size is 50 MB (after reaching this size no more logs are dumped).

Logs can be accessed using `mount_user_lfs_partition.py` script from `tools` directory.

M tools/mount_user_lfs_partition.py => tools/mount_user_lfs_partition.py +2 -2
@@ 7,8 7,8 @@ import os
parser = argparse.ArgumentParser(
    usage=
"\ne.g.:\n"
"For Linux: python3 tools/mount_user_lfs.py --mount_dir /mnt/user --lfsfuse build-linux-Debug/lfsfuse --image build-linux-Debug/PurePhone.img --loop 1\n"
"For  Pure: python3 tools/mount_user_lfs.py --mount_dir /mnt/user --lfsfuse build-rt1051-RelWithDebInfo/lfsfuse --part3_path /dev/sda3")
"For         simulator: python3 tools/mount_user_lfs_partition.py --mount_dir /mnt/user --lfsfuse build-linux-Debug/lfsfuse --image build-linux-Debug/PurePhone.img --loop 1\n"
"For device (MSC mode): python3 tools/mount_user_lfs_partition.py --mount_dir /mnt/user --lfsfuse build-rt1051-RelWithDebInfo/lfsfuse --part3_path /dev/sda3")

parser.add_argument('--mount_dir', type=str,
                    help="Directory where LFS should be mounted", required=True)