Multiple instances for QsLog



  • Hello,

    I am analyzing the QsLog feature for implementing logging facility in my Qt code. However, I do not understand how to create multiple logging files and log into them simultaneously. Can somebody please help me in this aspect?

    Thanks,
    Vidushi Sukhwal


  • Qt Champions 2016

    Hi
    This one ?
    https://bitbucket.org/codeimproved/qslog/overview

    I think files are called destinations

    Usage
    Directly including the QsLog source code in a project:
    Include QsLog.pri in your pro file
    Include QsLog.h in your C++ files. Include QsLogDest.h only where you create/add destinations.
    Get the instance of the logger by calling QsLogging::Logger::instance();
    Optionally set the logging level. Info is default.
    Create as many destinations as you want by using the QsLogging::DestinationFactory. <<<<< "file"
    Add the destinations to the logger instance by calling addDestination. <<<< "file"
    Start logging!

    http://qt.shoutwiki.com/wiki/Advanced,_cross-platform_logging_for_Qt
    Sample of the Destination stuff



  • Thank you for your reply. However, the problem is different. I would like to have two different destinations or log files in which I can write different log messages. For eg: I create two destinations A and B. I want QLOG_INFO<< "Hello A" to be added in A only and QLOG_INFO <<"Hello B" to be only added to B.

    In the current scenario, If two different destinations are added, then QLOG_INFO is added to both the destinations simultaneously.

    I


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.