# LogDoctor: Craplog Class Reference

Loading...
Searching...
No Matches
Craplog Class Referencefinal

Craplog. More...

`#include <craplog.h>`

Inheritance diagram for Craplog:

## Classes

struct | LogName
| Web Server specific file names criterions. More...

## Public Member Functions

DialogsLevel | getDialogsLevel () const noexcept
| Returns the Dialogs level.
void | setDialogsLevel (const DialogsLevel new_level) noexcept
| Sets the new Dialogs level.
const std::string & | getStatsDatabasePath () const noexcept
| Returns the path of the logs Collection database.
const std::string & | getHashesDatabasePath () const noexcept
| Returns the path of the log files' Hashes database.
void | setStatsDatabasePath (const std::string &path) noexcept
| Sets the new path for the logs Collection database.
void | setHashesDatabasePath (const std::string &path) noexcept
| Sets the new path for the log files' Hashes database.
void | setCurrentWebServer (const WebServer web_server) noexcept
| Sets the currently used Web Server ID.
WebServer | getCurrentWebServer () const noexcept
| Returns the currently used Web Server ID.
void | setCurrentLogFormat () noexcept
| Uses the current Web Server to set the relative logs format.
const LogsFormat & | getCurrentLogFormat () const noexcept
| Returns the currently used LogsFormat.
const std::string & | getLogsPath (const WebServer &web_server) const noexcept
| Returns the logs' path for the given web Server.
void | setLogsPath (const WebServer &web_server, const std::string &new_path) noexcept
| Sets a new path for the given Web Server to search the logs in.
bool | isFileNameValid (const std::string &name) const
| Checks if a file name respects the relative criterions.
const std::vector< LogFile > & | getLogsList () const noexcept
| Returns the list of log files for the current WebServer.
size_t | getLogsListSize () const noexcept
| Returns the amount of log files in the list.
const LogFile & | getLogFileItem (const QString &file_name) const
| Returns the LogFile instance of the given file.
bool | setLogFileSelected (const QString &file_name) noexcept
| Sets a file in the list as selected.
void | clearLogFilesSelection () noexcept
| Sets all files in the list as unselected.
bool | setApacheLogFormat (const std::string &format_string) noexcept
| Sets the Apache2 LogsFormat from the given format string.
bool | setNginxLogFormat (const std::string &format_string) noexcept
| Sets the Nginx LogsFormat from the given format string.
bool | setIisLogFormat (const std::string &format_string, const IISLogsModule log_module) noexcept
| Sets the IIS LogsFormat from the given format string.
const std::string & | getLogsFormatString (const WebServer &web_server) const noexcept
| Returns the logs format string for the given Web Server.
const LogsFormat & | getLogsFormat (const WebServer &web_server) const noexcept
| Returns the LogsFormat currently set for the given Web Server.
QString | getLogsFormatSample (const WebServer &web_server) const
| Returns a sample log line for the given Web Server using the relative LogsFormat.
bool | checkCurrentLogsFormat () const noexcept
| Checks whether the current Logs Format is valid or not.
size_t | getWarningSize () const noexcept
| Returns the currently set warning size for the log files.
void | setWarningSize (const size_t new_size) noexcept
| Sets the new warning size for the log files.
bool | checkStuff ()
| Various checks to be made before starting a new process.
bool | isParsing () const noexcept
| Returns whether the database has been edited or not during the process.
bool | editedDatabase () const noexcept
| Returns whether the database has been edited or not during the process.
size_t | getParsedSize () noexcept
| Returns the total logs size.
size_t | getParsedLines () noexcept
| Returns the parsed logs lines.
QString | getParsingSpeed () noexcept
| Returns the speed on parsing logs.
void | makeChart (const QChart::ChartTheme &theme, const std::unordered_map< std::string, QFont > &fonts, QChartView *size_chart) const
| Builds and draws the chart to be displayed in the main window.

## Private Member Functions

void | hireWorker (const Blacklists &blacklists) const
| Hires a worker to parse the selected logs.
void | changeIisLogsBaseNames (const IISLogsModule log_module)
| Changes the name criterions for IIS logs files names depending on the given module.

## Detailed Description

Craplog.

Performs operations related to the logs

## Member Function Documentation

## changeIisLogsBaseNames()

void Craplog::changeIisLogsBaseNames | ( | const IISLogsModule | log_module | ) |

private

Changes the name criterions for IIS logs files names depending on the given module.

Parameters

  log_module | The ID of the module to use to set the criterions

Exceptions

  DoNotCatchException |

See also
  LogName

## checkStuff()

bool Craplog::checkStuff | ( |  | ) |

Various checks to be made before starting a new process.

Checks the databases, the selected files and their size

Returns
  Whether the checks has been successful or not

Exceptions

  GenericException |

## clearLogFilesSelection()

void Craplog::clearLogFilesSelection | ( |  | ) |

noexcept

Sets all files in the list as unselected.

Returns
  Wheter the given file name has been found in the list

See also
  LogFile, logs_list

## getCurrentLogFormat()

const LogsFormat & Craplog::getCurrentLogFormat | ( |  | ) | const

noexcept

Returns the currently used LogsFormat.

Returns
  The LogsFormat

See also
  LogsFormat

## getCurrentWebServer()

WebServer Craplog::getCurrentWebServer | ( |  | ) | const

noexcept

Returns the currently used Web Server ID.

Returns
  The Web Server ID

## getLogFileItem()

const LogFile & Craplog::getLogFileItem | ( | const QString & | file_name | ) | const

Returns the LogFile instance of the given file.

Parameters

  file_name | The name of the file

Returns
  The LogFile instance

Exceptions

  GenericException |

See also
  LogFile, logs_list

## getLogsFormat()

const LogsFormat & Craplog::getLogsFormat | ( | const WebServer & | web_server | ) | const

noexcept

Returns the LogsFormat currently set for the given Web Server.

Parameters

  web_server | ID of the Web Server

Returns
  The LogsFormat instance

See also
  LogsFormat

## getLogsFormatSample()

QString Craplog::getLogsFormatSample | ( | const WebServer & | web_server | ) | const

Returns a sample log line for the given Web Server using the relative LogsFormat.

Parameters

  web_server | ID of the Web Server

Returns
  The sample of a log line

Exceptions

  DoNotCatchException |

See also
  FormatOps::getApacheLogSample(), FormatOps::getNginxLogSample(), FormatOps::getIisLogSample()

## getLogsFormatString()

const std::string & Craplog::getLogsFormatString | ( | const WebServer & | web_server | ) | const

noexcept

Returns the logs format string for the given Web Server.

Parameters

  web_server | ID of the Web Server

Returns
  The format string

See also
  FormatOps::LogsFormat

## getLogsList()

const std::vector< LogFile > & Craplog::getLogsList | ( |  | ) | const

noexcept

Returns the list of log files for the current WebServer.

Returns
  The list of log files

See also
  LogFile, logs_list

## getLogsListSize()

size_t Craplog::getLogsListSize | ( |  | ) | const

noexcept

Returns the amount of log files in the list.

Returns
  The number of files actually in the list

See also
  logs_list

## getLogsPath()

const std::string & Craplog::getLogsPath | ( | const WebServer & | web_server | ) | const

noexcept

Returns the logs' path for the given web Server.

Parameters

  web_server | The Web Server

Returns
  The path of the logs' folder

## isFileNameValid()

bool Craplog::isFileNameValid | ( | const std::string & | name | ) | const

Checks if a file name respects the relative criterions.

Parameters

  name | The name of the file

Returns
  Wheter it does respect the criterions or not

Exceptions

  DoNotCatchException |

See also
  LogName

## makeChart()

void Craplog::makeChart | ( | const QChart::ChartTheme & | theme,
|  | const std::unordered_map< std::string, QFont > & | fonts,
|  | QChartView * | size_chart ) const

Builds and draws the chart to be displayed in the main window.

Parameters

  theme | The base theme to use for the Chart
  fonts | The map holding the fonts
  size_chart | The widget which will display the chart

See also
  DonutBreakdown

## setApacheLogFormat()

bool Craplog::setApacheLogFormat | ( | const std::string & | format_string | ) |

noexcept

Sets the Apache2 LogsFormat from the given format string.

Parameters

  format_string | The logs format string

Returns
  Whether the process was successful or not

See also
  FormatOps, FormatOps::LogsFormat, FormatOps::processApacheFormatString()

## setCurrentLogFormat()

void Craplog::setCurrentLogFormat | ( |  | ) |

noexcept

Uses the current Web Server to set the relative logs format.

See also
  LogsFormat

## setCurrentWebServer()

void Craplog::setCurrentWebServer | ( | const WebServer | web_server | ) |

noexcept

Sets the currently used Web Server ID.

Parameters

  web_server | The new currently used Web Server

## setHashesDatabasePath()

void Craplog::setHashesDatabasePath | ( | const std::string & | path | ) |

noexcept

Sets the new path for the log files' Hashes database.

Parameters

  The | new path of the database file

## setIisLogFormat()

bool Craplog::setIisLogFormat | ( | const std::string & | format_string,
|  | const IISLogsModule | log_module )

noexcept

Sets the IIS LogsFormat from the given format string.

Parameters

  format_string | The logs format string
  log_module | The IIS logs module to be used to parse the format string

Returns
  Whether the process was successful or not

Exceptions

  DoNotCatchException |

See also
  FormatOps, FormatOps::LogsFormat, FormatOps::processIisFormatString()

## setLogFileSelected()

bool Craplog::setLogFileSelected | ( | const QString & | file_name | ) |

noexcept

Sets a file in the list as selected.

Parameters

  file_name | The name of the file

Returns
  Wheter the given file name has been found in the list

See also
  LogFile, logs_list

## setLogsPath()

void Craplog::setLogsPath | ( | const WebServer & | web_server,
|  | const std::string & | new_path )

noexcept

Sets a new path for the given Web Server to search the logs in.

Parameters

  web_server | The Web Server
  new_path | The new path

## setNginxLogFormat()

bool Craplog::setNginxLogFormat | ( | const std::string & | format_string | ) |

noexcept

Sets the Nginx LogsFormat from the given format string.

Parameters

  format_string | The logs format string

Returns
  Whether the process was successful or not

See also
  FormatOps, FormatOps::LogsFormat, FormatOps::processNginxFormatString()

## setStatsDatabasePath()

void Craplog::setStatsDatabasePath | ( | const std::string & | path | ) |

noexcept

Sets the new path for the logs Collection database.

Parameters

  The | new path of the database file

The documentation for this class was generated from the following files:

- logdoctor/modules/craplog/craplog.h
- logdoctor/modules/craplog/craplog.cpp