| 1 | #pragma once |
| 2 | |
| 3 | /**************************************************************************************** |
| 4 | ** QLogger is a library to register and print logs into a file. |
| 5 | ** |
| 6 | ** LinkedIn: www.linkedin.com/in/cescmm/ |
| 7 | ** Web: www.francescmm.com |
| 8 | ** |
| 9 | ** This library is free software; you can redistribute it and/or |
| 10 | ** modify it under the terms of the GNU Lesser General Public |
| 11 | ** License as published by the Free Software Foundation; either |
| 12 | ** version 2 of the License, or (at your option) any later version. |
| 13 | ** |
| 14 | ** This library is distributed in the hope that it will be useful, |
| 15 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | ** Lesser General Public License for more details. |
| 18 | ** |
| 19 | ** You should have received a copy of the GNU Lesser General Public |
| 20 | ** License along with this library; if not, write to the Free Software |
| 21 | ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 22 | ***************************************************************************************/ |
| 23 | |
| 24 | #include <QFlag> |
| 25 | |
| 26 | |
| 27 | namespace QLogger |
| 28 | { |
| 29 | |
| 30 | |
| 31 | /** |
| 32 | * @brief The LogLevel enum class defines the level of the log message. |
| 33 | */ |
| 34 | enum class LogLevel |
| 35 | { |
| 36 | Trace = 0, |
| 37 | Debug, |
| 38 | Info, |
| 39 | Warning, |
| 40 | Error, |
| 41 | Fatal |
| 42 | }; |
| 43 | |
| 44 | /** |
| 45 | * @brief The LogMode enum class defines the way to display the log message. |
| 46 | */ |
| 47 | enum class LogMode |
| 48 | { |
| 49 | Disabled = 0, |
| 50 | OnlyConsole, |
| 51 | OnlyFile, |
| 52 | Full |
| 53 | }; |
| 54 | |
| 55 | /** |
| 56 | * @brief The LogFileDisplay enum class defines which elements are written in the log file name. |
| 57 | */ |
| 58 | enum class LogFileDisplay |
| 59 | { |
| 60 | DateTime, |
| 61 | Number |
| 62 | }; |
| 63 | |
| 64 | /** |
| 65 | * @brief The LogTextDisplay enum class defines which elements are written by log message. |
| 66 | */ |
| 67 | enum class LogMessageDisplay : unsigned int |
| 68 | { |
| 69 | LogLevel = 1<<0, |
| 70 | ModuleName = 1<<1, |
| 71 | DateTime = 1<<2, |
| 72 | ThreadId = 1<<3, |
| 73 | Function = 1<<4, |
| 74 | File = 1<<5, |
| 75 | Line = 1<<6, |
| 76 | Message = 1<<7, |
| 77 | |
| 78 | Default = LogLevel|ModuleName|DateTime|ThreadId|File|Line|Message, |
| 79 | Default2 = LogLevel|ModuleName|DateTime|ThreadId|File|Function|Message, |
| 80 | Full = 0xFF |
| 81 | }; |
| 82 | Q_DECLARE_FLAGS(LogMessageDisplays, LogMessageDisplay) |
| 83 | Q_DECLARE_OPERATORS_FOR_FLAGS(LogMessageDisplays) |
| 84 | |
| 85 | |
| 86 | } |
| 87 | |