EMANE  1.0.1
EMANE::LogService Class Reference

Platform log service. More...

#include <logservice.h>

Inheritance diagram for EMANE::LogService:
EMANE::LogServiceProvider EMANE::Utils::Singleton< LogService >

Public Types

enum  { MAX_LOG_LENGTH = 1024 }
 

Public Member Functions

 ~LogService ()
 
void log (LogLevel level, const char *format,...) __attribute__((format(printf
 
void void vlog (LogLevel level, const char *format, va_list ap)
 
void log (LogLevel level, const Strings &strings)
 
void setLogLevel (LogLevel level)
 
void redirectLogsToFile (const std::string &file)
 
void open ()
 
template<typename Function >
void logfn (LogLevel level, Function fn)
 
template<typename Function >
void logfn (LogLevel level, Function fn, const char *fmt, va_list ap)
 
template<typename Function >
void logfn (LogLevel level, Function fn, const char *fmt,...) __attribute__((format(printf
 

Static Public Member Functions

static LogServiceinstance ()
 
static void destroy ()
 

Protected Member Functions

 LogService ()
 

Detailed Description

Platform log service.

Handles all logging tasks at the platform level

Definition at line 60 of file logservice.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
inherited
Enumerator
MAX_LOG_LENGTH 

Definition at line 125 of file logserviceprovider.h.

Constructor & Destructor Documentation

◆ ~LogService()

EMANE::LogService::~LogService ( )

Definition at line 103 of file logservice.cc.

◆ LogService()

EMANE::LogService::LogService ( )
protected

Definition at line 70 of file logservice.cc.

Member Function Documentation

◆ destroy()

static void EMANE::Utils::Singleton< LogService >::destroy ( )
inlinestaticinherited

Destroys the single instance of type T. Once destroyed it cannot be used or recreated. This is not a thread-safe method.

Definition at line 67 of file singleton.h.

◆ instance()

static LogService * EMANE::Utils::Singleton< LogService >::instance ( )
inlinestaticinherited

Provides thread-safe access to a single instance of type T. It does not provide thread-safety for T methods.

Returns
A pointer to T

Definition at line 56 of file singleton.h.

◆ log() [1/2]

void EMANE::LogService::log ( LogLevel  level,
const char *  fmt,
  ... 
)
virtual

Output a log message

Parameters
levelLog level of the message
fmtformat string (see printf)
...Variable data (see printf)

Reimplemented from EMANE::LogServiceProvider.

Definition at line 117 of file logservice.cc.

◆ log() [2/2]

void EMANE::LogService::log ( LogLevel  level,
const Strings strings 
)
virtual

Output a log message

Parameters
levelLog level of the message
stringsStrings to output

Implements EMANE::LogServiceProvider.

Definition at line 132 of file logservice.cc.

◆ logfn() [1/3]

template<typename Function >
void EMANE::LogServiceProvider::logfn ( LogLevel  level,
Function  fn 
)
inherited

Output a log message using a callable

Parameters
levelLog level of the message
fnCallable returning Strings

Definition at line 36 of file logserviceprovider.inl.

◆ logfn() [2/3]

template<typename Function >
void EMANE::LogServiceProvider::logfn ( LogLevel  level,
Function  fn,
const char *  fmt,
va_list  ap 
)
inherited

Output a log message using a callable

Parameters
levelLog level of the message
fnCallable returning Strings
fmtformat string (see printf)
apVariable argument list data (see vprintf)

Definition at line 46 of file logserviceprovider.inl.

◆ logfn() [3/3]

template<typename Function >
void EMANE::LogServiceProvider::logfn ( LogLevel  level,
Function  fn,
const char *  fmt,
  ... 
)
inherited

Output a log message using a callable

Parameters
levelLog level of the message
fnCallable returning Strings
fmtformat string (see printf)

Definition at line 64 of file logserviceprovider.inl.

◆ open()

void EMANE::LogService::open ( )

Definition at line 169 of file logservice.cc.

◆ redirectLogsToFile()

void EMANE::LogService::redirectLogsToFile ( const std::string &  file)

Definition at line 150 of file logservice.cc.

◆ setLogLevel()

void EMANE::LogService::setLogLevel ( LogLevel  level)

Definition at line 157 of file logservice.cc.

◆ vlog()

void EMANE::LogService::vlog ( LogLevel  level,
const char *  fmt,
va_list  ap 
)
virtual

Output a log message

Parameters
levelLog level of the message
fmtformat string (see printf)
apVariable argument list data (see vprintf)

Implements EMANE::LogServiceProvider.

Definition at line 141 of file logservice.cc.


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