Loom 4 v4.5
Arduino library for Internet of Things Rapid Prototyping in environmental sensing
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | List of all members
Logger Class Reference

#include <Logger.h>

Public Member Functions

 Logger (const Logger &obj)=delete
 
void setSDManager (SDManager *manager)
 
void setHypnos (Loom_Hypnos *hypnos)
 
void debugLog (const char *message, bool silent, const char *file, const char *func, unsigned long lineNumber)
 
void errorLog (const char *message, bool silent, const char *file, const char *func, unsigned long lineNumber)
 
void warningLog (const char *message, bool silent, const char *file, const char *func, unsigned long lineNumber)
 
void debugLog (const __FlashStringHelper *message, bool silent, const char *file, const char *func, unsigned long lineNumber)
 
void warningLog (const __FlashStringHelper *message, bool silent, const char *file, const char *func, unsigned long lineNumber)
 
void errorLog (const __FlashStringHelper *message, bool silent, const char *file, const char *func, unsigned long lineNumber)
 
void genericLog (const char *level, const char *message, bool silent, const char *file, const char *func, unsigned long lineNumber)
 
void logLong (char *message, bool silent)
 
void startFunction (const char *file, const char *func, unsigned long num, int freeMemory)
 
void endFunction (int freeMemory)
 
void enableSummaries ()
 
void enableSD ()
 

Static Public Member Functions

static LoggergetInstance ()
 

Detailed Description

Arduino Logger class that allows for standardized log outputs as well as function memory usage summaries to find memory leaks that may lead to unexpected crashing

Author
Will Richards

Member Function Documentation

◆ debugLog() [1/2]

void Logger::debugLog ( const __FlashStringHelper *  message,
bool  silent,
const char *  file,
const char *  func,
unsigned long  lineNumber 
)
inline

Logs a Debug Message to the SD card and the serial monitor

Parameters
messageMessage to log
silentIf set to silent it will not appear in the serial monitor
lineNumberThe current line number this log is on

◆ debugLog() [2/2]

void Logger::debugLog ( const char *  message,
bool  silent,
const char *  file,
const char *  func,
unsigned long  lineNumber 
)
inline

Logs a Debug Message to the SD card and the serial monitor

Parameters
messageMessage to log
silentIf set to silent it will not appear in the serial monitor
lineNumberThe current line number this log is on

◆ endFunction()

void Logger::endFunction ( int  freeMemory)
inline

Marks the end of a function, logs summary to SD card

Parameters
retOpenly typed variable to show the return type of the function

◆ errorLog() [1/2]

void Logger::errorLog ( const __FlashStringHelper *  message,
bool  silent,
const char *  file,
const char *  func,
unsigned long  lineNumber 
)
inline

Logs an Error Message to the SD card and the serial monitor

Parameters
messageMessage to log
silentIf set to silent it will not appear in the serial monitor
lineNumberThe current line number this log is on

◆ errorLog() [2/2]

void Logger::errorLog ( const char *  message,
bool  silent,
const char *  file,
const char *  func,
unsigned long  lineNumber 
)
inline

Logs an Error Message to the SD card and the serial monitor

Parameters
messageMessage to log
silentIf set to silent it will not appear in the serial monitor
lineNumberThe current line number this log is on

◆ genericLog()

void Logger::genericLog ( const char *  level,
const char *  message,
bool  silent,
const char *  file,
const char *  func,
unsigned long  lineNumber 
)
inline

Generic logging function to cut down on redundant code in each log function

Parameters
levelStrings representing different log levels eg. DEBUG, WARNING, ERROR
messageThe actual message we want to log
silentWhether or not we want to actually print the data to the Serial monitor or just log it to the SD card
fileName of the file in which the log was called
funcName of the function in which the log was called
lineNumberThe line number that the log was called on

◆ setHypnos()

void Logger::setHypnos ( Loom_Hypnos hypnos)
inline

Set the instance of the Hypnos, this should be used if you want the current timestamp added to the front of the logger output

Parameters
hypnosPointer to the hypnos object this also sets the sdInst

◆ setSDManager()

void Logger::setSDManager ( SDManager manager)
inline

Set the instance of the SD Manager

Parameters
managerPointer to the SD manager to allow us to utilize SD logging functionality

◆ startFunction()

void Logger::startFunction ( const char *  file,
const char *  func,
unsigned long  num,
int  freeMemory 
)
inline

Marks the start of a new function

Parameters
fileFile name that the function is in
funcFunction name that this call is in
numCurrent line number in the file of which this call is located

◆ warningLog() [1/2]

void Logger::warningLog ( const __FlashStringHelper *  message,
bool  silent,
const char *  file,
const char *  func,
unsigned long  lineNumber 
)
inline

Logs a Warning Message to the SD card and the serial monitor

Parameters
messageMessage to log
silentIf set to silent it will not appear in the serial monitor
lineNumberThe current line number this log is on

◆ warningLog() [2/2]

void Logger::warningLog ( const char *  message,
bool  silent,
const char *  file,
const char *  func,
unsigned long  lineNumber 
)
inline

Logs a Warning Message to the SD card and the serial monitor

Parameters
messageMessage to log
silentIf set to silent it will not appear in the serial monitor
lineNumberThe current line number this log is on

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