Loading...
Searching...
No Matches
LogOps Class Reference

LogOps. More...

`#include <logs.h>`

## Public Types

enum | LogType { Failed = -1 , Discarded = 0 , Access = 1 }
| Enumerates log file types. More...

## Public Member Functions

LogType | defineFileType (const std::vector< std::string > &lines, const FormatOps::LogsFormat &format)
| Defines the type of a file. More...
void | cleanLines (std::vector< std::string > &lines)
| Removes commented lines from the given list. More...
void | parseLines (std::vector< std::unordered_map< int, std::string > > &data, const std::vector< std::string > &lines, const FormatOps::LogsFormat &format)
| Parses log lines to extract data. More...
void | resetPerfData ()
| Resets the performances data.
const unsigned | getTotalSize ()
| Returns the total size of the logs lines. More...
const unsigned | getParsedSize ()
| Returns the parsed logs size. More...
const unsigned | getParsedLines ()
| Returns the number of parsed log lines. More...

## Private Member Functions

bool | deepTypeCheck (const std::string &line, const FormatOps::LogsFormat &format)
| Parse the given line using the given format. More...
const std::unordered_map< int, std::string > | parseLine (const std::string &line, const FormatOps::LogsFormat &format)
| Parses a line to extract data. More...

## Private Attributes

unsigned | total_size =0
| Total size of the parsed logs. More...
unsigned | parsed_size =0
| Size of the parsed logs. More...
unsigned | parsed_lines =0
| Number of parsed logs lines. More...

## Detailed Description

LogOps.

Operations for the logs

## Member Enumeration Documentation

## LogType

enum LogOps::LogType

Enumerates log file types.

File types used to decide whether a file should be considered valid or not

See also
  defineFileType()

Enumerator
Failed | Failed to determine the type.
Discarded | Not a valid file, will be discarded.
Access | Valid access logs file type.

## Member Function Documentation

## cleanLines()

void LogOps::cleanLines | ( | std::vector< std::string > & | lines | ) |

Removes commented lines from the given list.

Parameters

  lines | The lines to clean

## deepTypeCheck()

bool LogOps::deepTypeCheck | ( | const std::string & | line,
|  | const FormatOps::LogsFormat & | format
| ) |  |

private

Parse the given line using the given format.

Parameters

  line | The log line to check
  format | The logs format to use

Returns
  Whether the line respects the format or not

See also
  defineFileType(), FormatOps::LogsFormat

## defineFileType()

LogOps::LogType LogOps::defineFileType | ( | const std::vector< std::string > & | lines,
|  | const FormatOps::LogsFormat & | format
| ) |  |

Defines the type of a file.

Parameters

  lines | A list of (randomly picked) lines from the file to examine
  format | The logs format to use to determine if the file is valid or not

Returns
  The resulting file type

See also
  LogType, deepTypeCheck(), FormatOps::LogsFormat

## getParsedLines()

const unsigned LogOps::getParsedLines | ( |  | ) |

Returns the number of parsed log lines.

See also
  parsed_lines

## getParsedSize()

const unsigned LogOps::getParsedSize | ( |  | ) |

Returns the parsed logs size.

See also
  parsed_size

## getTotalSize()

const unsigned LogOps::getTotalSize | ( |  | ) |

Returns the total size of the logs lines.

See also
  total_size

## parseLine()

const std::unordered_map< int, std::string > LogOps::parseLine | ( | const std::string & | line,
|  | const FormatOps::LogsFormat & | format
| ) |  |

private

Parses a line to extract data.

Parameters

  line | The log line to parse
  format | The logs format to use

Returns
  A data collection item

Exceptions

  LogParserException |

See also
  parseLines(), Craplog::data_collection, FormatOps::LogsFormat

## parseLines()

void LogOps::parseLines | ( | std::vector< std::unordered_map< int, std::string > > & | data,
|  | const std::vector< std::string > & | lines,
|  | const FormatOps::LogsFormat & | format
| ) |  |

Parses log lines to extract data.

Parameters

  data | The data collection which will hold the data
  lines | The list of lines to parse
  format | The logs format to use

Exceptions

  LogParserException |

See also
  parseLine(), Craplog::parseLogLines(), FormatOps::LogsFormat

## Member Data Documentation

## parsed_lines

unsigned LogOps::parsed_lines =0

private

Number of parsed logs lines.

See also
  getParsedLines()

## parsed_size

unsigned LogOps::parsed_size =0

private

Size of the parsed logs.

See also
  getParsedSize()

## total_size

unsigned LogOps::total_size =0

private

Total size of the parsed logs.

See also
  getTotalSize()

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

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