X-Git-Url: https://vaikene.ee/gitweb/highlight.css?a=blobdiff_plain;f=src%2Flibs%2FCommon%2Flogger.h;h=6e49ef723bcbd621fb65206045a1e671d4ff889c;hb=18ba5c0014514a8248a77dd36d8ee8d9acc3227b;hp=1dfdc62408a805f0ed985b93b36eb638898bbdc8;hpb=85a8276c733281ce982fcf4ed7fdc96b8880b5ba;p=evaf diff --git a/src/libs/Common/logger.h b/src/libs/Common/logger.h index 1dfdc62..6e49ef7 100644 --- a/src/libs/Common/logger.h +++ b/src/libs/Common/logger.h @@ -3,7 +3,7 @@ * @brief iLogger interface implementation * @author Enar Vaikene * - * Copyright (c) 2011 Enar Vaikene + * Copyright (c) 2011-2012 Enar Vaikene * * This file is part of the eVaf C++ cross-platform application development framework. * @@ -54,8 +54,6 @@ public: /** * Initializes the source * @param source Name of the source - * @param logDir Full path to the log directory - * @param etcDir Full path to the configuration files directory * * This function initializes the newly created logger source and sets initial * parameters for the source. @@ -73,25 +71,28 @@ public: * Example logger.ini file: * @code * [.default] - * severity = Fatal - * maxSize = 100 - * maxCount = 3 + * log_level = Fatal + * log_size = 100 + * log_count = 3 * * [my-source] - * severity = Warning - * maxSize = 1000 - * maxCount = 10 + * log_level = Warning + * log_size = 1000 + * log_count = 10 * @endcode */ - void init(QString const & source, QString const & logDir, QString const & etcDir); + void init(QString const & source); public: // Members (we don't bother adding getter/setter functions) + /// Name of the source + QString name; + /// Current severity level iLogger::Severity severity; - /// Current log file name + /// File name QString fileName; /// Current maximum size of log files @@ -142,7 +143,7 @@ public: virtual ~Logger(); /** - * Initializes the interface implementation + * Initializes the iLogger interface implementation * @return True if ok; false if initialization failed */ bool init(); @@ -151,7 +152,7 @@ public: iLogger interface */ - virtual QString defaultSource() const { return mDefaultSource; } + virtual QString defaultSource() const; virtual void setDefaultSource(QString const & source); @@ -187,16 +188,19 @@ signals: private: // Members + /// Flag indicating that logger is fully initialized + bool mReady; + /// Current fatal error message handler FatalMsgHandler mFatalMsgHandler; /// Console output severity level iLogger::Severity mConsoleSeverity; - /// Current default source (defaults to "evaf") - QString mDefaultSource; + /// Default logger source + QExplicitlySharedDataPointer mDefaultSource; - /// Logger sources + /// Other logger sources QHash > mSources; /// Worker thread @@ -209,7 +213,7 @@ private: // Members private: // Methods /// Returns the source by the name. The source is created if it does not exist yet. - LoggerSource * getSource(QString const & name); + LoggerSource * getSource(QString const & name = QString()); #ifdef Q_OS_WIN32 /// Changes text colors on the Windows console