LoboMQ
Loading...
Searching...
No Matches
Logger.h File Reference
#include <iostream>
#include <SD.h>
#include <SPI.h>
#include <Elog.h>

Go to the source code of this file.

Macros

#define DEFAULT_LOG_LEVEL   Loglevel::INFO
 

Enumerations

enum  LoggerClass { BROKER = 0 , PUBLISHER , SUBSCRIBER , UNKNOWN }
 Enumerates every log class that represents the part of the library which is being logged. More...
 

Functions

Elog * initializeSerialLogger (LoggerClass className, Loglevel level=DEFAULT_LOG_LEVEL)
 Creates a logger that prints messages to the serial monitor.
 
Elog * initializeSDLogger (LoggerClass className, int cs, int sck, int miso, int mosi, Loglevel level=DEFAULT_LOG_LEVEL)
 Creates a logger that prints messages to a file inside a SD card.
 
Elog * disableLogger ()
 Creates a logger without the ability to print messages.
 

Detailed Description

Author
Rubén Gómez Villegas

This file contains the necessary definitions and declarations to easily create an Elog logger object for LoboMQ.

Definition in file Logger.h.

Macro Definition Documentation

◆ DEFAULT_LOG_LEVEL

#define DEFAULT_LOG_LEVEL   Loglevel::INFO

Definition at line 19 of file Logger.h.

Enumeration Type Documentation

◆ LoggerClass

Enumerates every log class that represents the part of the library which is being logged.

Enumerator
BROKER 

Broker log class.

PUBLISHER 

Publisher log class.

SUBSCRIBER 

Subscriber log class.

UNKNOWN 

Log class unknown or generic.

Definition at line 25 of file Logger.h.

Function Documentation

◆ disableLogger()

Elog * disableLogger ( )

Creates a logger without the ability to print messages.

This function creates a logger used by the broker or client which will not print any message produced by the library.

Returns
A pointer to an Elog instance set up to not log messages.

Definition at line 52 of file Logger.cpp.

◆ initializeSDLogger()

Elog * initializeSDLogger ( LoggerClass className,
int cs,
int sck,
int miso,
int mosi,
Loglevel level = DEFAULT_LOG_LEVEL )

Creates a logger that prints messages to a file inside a SD card.

This function creates a logger used by the broker or client which prints messages to a file in the SD card as most critical as the indicated.

Parameters
classNameThe log class.
csThe Chip Select pin of the SD card module.
sckThe Serial Clock pin of the SD card module.
misoThe Master In Slave Out pin of the SD card module.
mosiThe Master Out Slave In pin of the SD card module.
levelThe most critical level of registration in which there is interest.
Returns
A pointer to an Elog instance set up to log to the SD card.

Definition at line 34 of file Logger.cpp.

◆ initializeSerialLogger()

Elog * initializeSerialLogger ( LoggerClass className,
Loglevel level = DEFAULT_LOG_LEVEL )

Creates a logger that prints messages to the serial monitor.

This function creates a logger used by the broker or client which prints messages to the serial monitor as most critical as the indicated.

Parameters
classNameThe log class.
levelThe most critical level of registration in which there is interest.
Returns
A pointer to an Elog instance set up to log through the serial monitor.

Definition at line 13 of file Logger.cpp.