LogConfig C++

Namespaces

 dpyLogconfig
 Deepsy LogConfig namespace that includes the different enums, structs or method signatures that should be used.
 

Classes

class  LogConfig
 This class is used to modify the log configuration. More...
 
class  LogConfigClient
 Interacts with Logging service. More...
 

Detailed Description

Examples

  • Getting the list of services and apps which are using LogConfig

    #include <iostream>
    #include <vector>
    #include <dpy/logconfigApi.h>
    void list_handler(boost::system::error_code ec, std::vector<dpyLogconfig::App> apps)
    {
    if (ec.value() == 0) {
    for (unsigned int i = 0; i < apps.size(); i++) {
    std::cout << "\r\n" << "------------------------------------------------" << std::endl;
    std::cout << "[ " << apps[i].appname << " ]" << std::endl;
    std::cout << "------------------------------------------------"<< std::endl;
    std::cout << "Level: " << apps[i].level << std::endl;
    std::cout << "Path: " << apps[i].path << "\n" << std::endl;
    }
    } else {
    std::cout << "\rError : " << ec.message() << std::endl;
    }
    }
    int main(int argc, char *argv[])
    {
    LogConfig logConfig;
    logConfig.asyncGetStatus(list_handler);
    }

  • Get the logging status of a particular app

    #include <iostream>
    #include <cctype>
    #include <vector>
    #include <stdlib.h>
    #include <dpy/logconfigApi.h>
    void get_log_status_handler(boost::system::error_code ec, std::vector<dpyLogconfig::App> apps)
    {
    if (ec.value() == 0) {
    for (unsigned int i = 0; i < apps.size(); i++) {
    std::cout << "\r\n" << "------------------------------------------------" << std::endl;
    std::cout << "[ " << apps[i].appname << " ]" << std::endl;
    std::cout << "------------------------------------------------"<< std::endl;
    std::cout << "Level: " << apps[i].level << std::endl;
    std::cout << "Path: " << apps[i].path << "\n" << std::endl;
    }
    } else {
    std::cout << "\rError : " << ec.message() << std::endl;
    }
    }
    int main(int argc, char *argv[])
    {
    LogConfig logConfig;
    std::string appName = "Modem";
    logConfig.asyncGetStatus(get_log_status_handler, appName);
    }

  • How to change the log level

    #include <iostream>
    #include <dpy/logconfigApi.h>
    void set_level_handler(boost::system::error_code ec)
    {
    if (ec.value() != 0) {
    std::cout << "\rError : " << ec.message() << std::endl;
    } else {
    std::cout << "\rSynchronous operation performed successfully" << std::endl;
    }
    }
    int main(int argc, char *argv[])
    {
    LogConfig logConfig;
    std::string appName = "Modem";
    std::string level = "Debug";
    logConfig.asyncSetLevel(appName, level, set_level_handler);
    }