Formatter

struct Formatter : IFormatter {
    string format (std::string& msg, const Info& info) const override {
        std::stringstream ss;
        ss << info.file <<  ":" << to_string(info.line) << "\t" << msg << std::endl;
        auto ret = ss.str();
        return string(ret.data(), ret.size());
    }
};
set_formatter(new Formatter());

Formatter is an object that produce a string from all the information provided by logging library and user.

To customize format implement IFormatter an overload string format (std::string& msg, const Info& info) const method. msg is a message passed to log macro(i.e. panda_log_debug) and info is additional information:

Pattern Formater

A formatter based on a pattern string. It is printf-like string. Tokens can look like %X or %xX or %.yX or %x.yX. x and y are tokent's digital arguments like precision for doubles in printf. I.e. %2.3t is a time HH:MM:SS and 3 digits of milliseconds.

%L - level

%M - module. if module has no name (root), removes x chars on the left and y chars on the right.

%F - function

%f - file

%l - line

%m - message

%t - current time

%T - current thread id

%p - current process id

%P - current process title

%c - start color

%C - end color