advancedtelematic / aktualizr

C++ SOTA Client
Mozilla Public License 2.0
144 stars 61 forks source link

Integrate logging framework #3

Closed codders closed 8 years ago

codders commented 8 years ago

Integrate a logging framework with support for TRACE, DEBUG, INFO, WARN and ERROR logging.

Log level should be configurable by config file and overridable by command-line argument or environment variable

embmk commented 8 years ago

Pushed an intermediate result. I updated the dependencies but I don't know if it is necessary to name the pthread stubs. As the command line options are working, I decided to use a command line option to overwrite the level that is set using the configuration file in future. I implemented c-like setter and getter for the logging level because the boost logging framework does not provide a method to get the currently used level.

jeremiah commented 8 years ago

If the SOTA client is going to run on a head unit or a vehicle, you'll like have diagnostic log and trace available. Have you considered using DLT for logging? https://github.com/GENIVI/dlt-daemon

codders commented 8 years ago

Welcome aboard @jeremiah. DLT is a fine suggestion - I'll add it to the backlog. I don't think we want it there as a hard dependency, because we want to make the binary as portable and compact as possible, but we already have a modular architecture and configurable build options in mind. This would be a great option to have.

@embmk - with that in mind, the current logging branch integrates Boost logging quite concretely into main.cpp. It would be great if you could keep any details of the actual logging framework hidden away in log.hpp, so that we have the option to add in DLT as a logger later on. For your reference, you can see what the interface to DLT looks like here:

https://github.com/GENIVI/dlt-daemon/blob/b348642/doc/dlt_user_manual.txt#L207-L232

codders commented 8 years ago

@embmk I've just pushed a version of the branch that compiles and passes CI. Please fetch and rebase before you continue development

jeremiah commented 8 years ago

Just to add to the confusion^W^W^Wdiscussion, we have an IVI logging tool in C++ that makes it easy to integrate into DLT and to use other logging mechanisms if you prefer: https://github.com/Pelagicore/ivi-logging

We maintain it at Pelagicore and its Free Software under the Mozilla Public License 2.0.

codders commented 8 years ago

Thanks @jeremiah . I suggest we skip that for now. It does look super handy, but I'm trying to keep the runtime linking requirements of the client minimal for now (and ivi-logging is anyhow not a library that's available in Debian, so it would complicate our CI process). If @embmk can keep the binding to boost-logging fairly well encapsulated, it shouldn't be too difficult to migrate to ivi-logging later on when we feel moved to do so.

jeremiah commented 8 years ago

Now I have a good argument for asking the ivi-logging dev to package his software for Debian. :-)