Just Intonation  Version 1.3.0 (18)
Explore scale-independent dynamically adapting tuning in just intonation
Log Class Reference

Base class for managing log messages. More...

#include <log.h>

Inheritance diagram for Log:
Inheritance graph
Collaboration diagram for Log:
Collaboration graph

Public Member Functions

void setVerbosity (int verbosity)
 Set the verbosity level of the class-specific messages. More...
 
int getVerbosity ()
 Get the actual verbosity level. More...
 

Protected Member Functions

 Log ()
 Constructor of the Log base class. More...
 

Private Member Functions

QString createLogMessage (int line, QString path, QString function, int level)
 Class-specific function generating the log message string. More...
 
void setModuleName (const QString &name)
 Specify the name of the class-specific module. More...
 
QString getModuleName () const
 Get module name. More...
 

Private Attributes

int messageVerbosity
 Verbosity of error messages. More...
 
QString mModule
 Name of the module. More...
 

Detailed Description

Base class for managing log messages.

This class manages the console messages of the application. There are four different types of messages:

  • Status messages which appear frequently (e.g. timer timeout)
  • Normal messages which appear on a certain action (e.g. open file)
  • Warning messages
  • Error messages

Usage:

Include log.h and use

LOGSTATUS << ...
LOGMESSAGE << ...
LOGWARNING << ...
LOGERROR << ...

with streamed arguments analog to qDebug(). The message will also include the function name, the file name, and the line number. If the messages originate from a class that is derived from Log, then the messages will also contain the full class name. In addition, the name of the module can be specified. The messages can be filtered by setting the verbosity in the range from 1 (only errors) to 4 (all four types of messages).

Definition at line 83 of file log.h.

Constructor & Destructor Documentation

Log::Log ( )
protected

Constructor of the Log base class.

If you would like to see the class name in the messages derive your class from Log.

Definition at line 64 of file log.cpp.

Member Function Documentation

QString Log::createLogMessage ( int  line,
QString  path,
QString  function,
int  level 
)
private

Class-specific function generating the log message string.

Parameters
line: Line number
path: Full path of the function
function: Name of the function
level: Verbosity level
Returns
QString of the message

Definition at line 133 of file log.cpp.

QString Log::getModuleName ( ) const
private

Get module name.

Returns
Name of the module, empty if it was not set before

Definition at line 93 of file log.cpp.

int Log::getVerbosity ( )

Get the actual verbosity level.

Returns
: Verbosity level (1...4)

Definition at line 118 of file log.cpp.

void Log::setModuleName ( const QString &  name)
private

Specify the name of the class-specific module.

Usually several classes belong to a module. For classes derived from Log it is possible to specify the module name. This should be done in the constructor of the class.

Parameters
name: Name of the module

Definition at line 82 of file log.cpp.

void Log::setVerbosity ( int  verbosity)

Set the verbosity level of the class-specific messages.

Parameters
verbosity: Verbosity level (1...4)

Definition at line 107 of file log.cpp.

Member Data Documentation

int Log::messageVerbosity
private

Verbosity of error messages.

Definition at line 101 of file log.h.

QString Log::mModule
private

Name of the module.

Definition at line 102 of file log.h.


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