1 /* 2 SPDX-FileCopyrightText: 2007 Nicolas Ternisien <nicolas.ternisien@gmail.com> 3 4 SPDX-License-Identifier: GPL-2.0-or-later 5 */ 6 7 #pragma once 8 9 #include "fileAnalyzer.h" 10 11 #include "ksystemlog_debug.h" 12 13 #include "cupsLogMode.h" 14 #include "localLogFileReader.h" 15 #include "parsingHelper.h" 16 17 #define DEBUG2_LOG_LEVEL_ICON "source" 18 19 class CupsAnalyzer : public FileAnalyzer 20 { 21 Q_OBJECT 22 23 public: 24 explicit CupsAnalyzer(LogMode *logMode); 25 26 ~CupsAnalyzer() override; 27 28 LogViewColumns initColumns() override; 29 30 protected: 31 LogFileReader *createLogFileReader(const LogFile &logFile) override; 32 33 Analyzer::LogFileSortMode logFileSortMode() override; 34 35 /* 36 * Also sees : 37 * https://www.cups.org/doc/man-cupsd-logs.html 38 * level date-time message 39 * 40 * Levels : 41 * A - Alert message (LogLevel alert) 42 * C - Critical error message (LogLevel crit) 43 * D - Debugging message (LogLevel debug) 44 * d - Detailed debugging message (LogLevel debug2) 45 * E - Normal error message (LogLevel error) 46 * I - Informational message (LogLevel info) 47 * N - Notice message (LogLevel notice) 48 * W - Warning message (LogLevel warn) 49 * X - Emergency error message (LogLevel emerg) 50 * 51 * Log line examples : 52 * I [15/Feb/2004:01:29:32 +0100] LoadPPDs: No new or changed PPDs... 53 * E [15/Feb/2004:01:43:15 +0100] Scheduler shutting down due to SIGTERM. 54 * 55 */ 56 LogLine *parseMessage(const QString &logLine, const LogFile &originalLogFile) override; 57 58 private: 59 QMap<QChar, LogLevel *> mMapTypeLevels; 60 61 void initializeTypeLevels(); 62 63 LogLevel *findLogLevel(QChar type); 64 }; 65 66