QuasarAppLib/qalogger.h

61 lines
1.7 KiB
C
Raw Normal View History

2024-06-24 13:23:40 +02:00
/*
2024-12-30 22:39:49 +01:00
* Copyright (C) 2024-2025 QuasarApp.
2024-06-24 13:23:40 +02:00
* Distributed under the lgplv3 software license, see the accompanying
* Everyone is permitted to copy and distribute verbatim copies
* of this license document, but changing it is not allowed.
*/
#ifndef QALOGGER_H
#define QALOGGER_H
#include "quasarapp_global.h"
2025-02-07 11:56:30 +01:00
#include <QFile>
2024-06-24 13:23:40 +02:00
#include <QList>
namespace QuasarAppUtils {
/**
* @brief The QALogger class is logger handler for app.
2025-02-07 11:56:30 +01:00
* This class allow to log all message from app to file.
2025-02-07 12:00:00 +01:00
*
* Example:
* @code
* #include <qalogger.h>
*
* QuasarAppUtils::QALogger logger;
*
2025-02-07 12:11:26 +01:00
* QuasarAppUtils::Params::setEnable("fileLog", true); //force enable file writing using efault file location - located in localApplication data.
*
2025-02-07 12:00:00 +01:00
* QuasarAppUtils::Params::parseParams(argc, argv);
*
* logger.init();
* @endcode
2025-02-07 12:13:03 +01:00
*
*
* Standart file log locations per platforms :
* - Windows: %APPDATA%/OrganisationName/YourAppName/YourAppName.log
* - Linux: $HOME/.config/OrganisationName/YourAppName/YourAppName.log
* - Mac: $HOME/Library/Application Support/OrganisationName/YourAppName/YourAppName.log
* - Android: /data/data/com.organisationName.yourAppName/files/YourAppName.log
* - iOS: /var/mobile/Applications/Data/YourAppName/YourAppName.log
*
* you can overiwite this location by setting "fileLog" option in Params.
2024-06-24 13:23:40 +02:00
*/
class QUASARAPPSHARED_EXPORT QALogger
{
public:
QALogger();
2025-02-07 11:56:30 +01:00
~QALogger();
2024-06-24 13:23:40 +02:00
2024-06-24 13:27:03 +02:00
/**
* @brief init This method initialize logging of all qt message into file.
2025-02-07 12:00:00 +01:00
* @note This function should be invokae after parsing arguments.
* if you invoke this before parsing arguments, verbose level of logs will not created correct.
2024-06-24 13:27:03 +02:00
*/
2024-06-24 13:23:40 +02:00
void init();
};
}
#endif // QALOGGER_H