Electroneum
el::Helpers Class Reference

Static helpers for developers. More...

#include <easylogging++.h>

Inheritance diagram for el::Helpers:
Collaboration diagram for el::Helpers:

Static Public Member Functions

static void setStorage (base::type::StoragePointer storage)
 Shares logging repository (base::Storage) More...
 
static base::type::StoragePointer storage ()
 
static void setArgs (int argc, char **argv)
 Sets application arguments and figures out whats active for logging and whats not. More...
 
static void setArgs (int argc, const char **argv)
 Sets application arguments and figures out whats active for logging and whats not. More...
 
static void setThreadName (const std::string &name)
 Sets thread name for current thread. Requires std::thread. More...
 
static std::string getThreadName ()
 
static void installPreRollOutCallback (const PreRollOutCallback &callback)
 Installs pre rollout callback, this callback is triggered when log file is about to be rolled out (can be useful for backing up) More...
 
static void uninstallPreRollOutCallback (void)
 Uninstalls pre rollout callback. More...
 
template<typename T >
static bool installLogDispatchCallback (const std::string &id)
 Installs post log dispatch callback, this callback is triggered when log is dispatched. More...
 
template<typename T >
static void uninstallLogDispatchCallback (const std::string &id)
 Uninstalls log dispatch callback. More...
 
template<typename T >
static TlogDispatchCallback (const std::string &id)
 
template<typename T >
static std::string convertTemplateToStdString (const T &templ)
 Converts template to std::string - useful for loggable classes to log containers within log(std::ostream&) const. More...
 
static const el::base::utils::CommandLineArgscommandLineArgs (void)
 Returns command line arguments (pointer) provided to easylogging++. More...
 
static void reserveCustomFormatSpecifiers (std::size_t size)
 Reserve space for custom format specifiers for performance. More...
 
static void installCustomFormatSpecifier (const CustomFormatSpecifier &customFormatSpecifier)
 Installs user defined format specifier and handler. More...
 
static bool uninstallCustomFormatSpecifier (const char *formatSpecifier)
 Uninstalls user defined format specifier and handler. More...
 
static bool hasCustomFormatSpecifier (const char *formatSpecifier)
 Returns true if custom format specifier is installed. More...
 
static void validateFileRolling (Logger *logger, Level level)
 

Detailed Description

Static helpers for developers.

Definition at line 3715 of file easylogging++.h.

Member Function Documentation

◆ commandLineArgs()

static const el::base::utils::CommandLineArgs* el::Helpers::commandLineArgs ( void  )
inlinestatic

Returns command line arguments (pointer) provided to easylogging++.

Definition at line 3819 of file easylogging++.h.

3819  {
3820  return ELPP->commandLineArgs();
3821  }
#define ELPP

◆ convertTemplateToStdString()

template<typename T >
static std::string el::Helpers::convertTemplateToStdString ( const T templ)
inlinestatic

Converts template to std::string - useful for loggable classes to log containers within log(std::ostream&) const.

Definition at line 3799 of file easylogging++.h.

3799  {
3800  el::Logger* logger =
3801  ELPP->registeredLoggers()->get(el::base::consts::kDefaultLoggerId);
3802  if (logger == nullptr) {
3803  return std::string();
3804  }
3805  base::MessageBuilder b;
3806  b.initialize(logger);
3807  logger->acquireLock();
3808  b << templ;
3809 #if defined(ELPP_UNICODE)
3810  std::string s = std::string(logger->stream().str().begin(), logger->stream().str().end());
3811 #else
3812  std::string s = logger->stream().str();
3813 #endif // defined(ELPP_UNICODE)
3814  logger->stream().str(ELPP_LITERAL(""));
3815  logger->releaseLock();
3816  return s;
3817  }
Represents a logger holding ID and configurations we need to write logs.
virtual void acquireLock(void) ELPP_FINAL
virtual void releaseLock(void) ELPP_FINAL
#define ELPP_LITERAL(txt)
::std::string string
Definition: gtest-port.h:1097
Here is the call graph for this function:

◆ getThreadName()

static std::string el::Helpers::getThreadName ( )
inlinestatic

Definition at line 3737 of file easylogging++.h.

3737  {
3738  return ELPP->getThreadName(base::threading::getCurrentThreadId());
3739  }

◆ hasCustomFormatSpecifier()

static bool el::Helpers::hasCustomFormatSpecifier ( const char *  formatSpecifier)
inlinestatic

Returns true if custom format specifier is installed.

Definition at line 3836 of file easylogging++.h.

3836  {
3837  return ELPP->hasCustomFormatSpecifier(formatSpecifier);
3838  }

◆ installCustomFormatSpecifier()

static void el::Helpers::installCustomFormatSpecifier ( const CustomFormatSpecifier customFormatSpecifier)
inlinestatic

Installs user defined format specifier and handler.

Definition at line 3828 of file easylogging++.h.

3828  {
3829  ELPP->installCustomFormatSpecifier(customFormatSpecifier);
3830  }

◆ installLogDispatchCallback()

template<typename T >
static bool el::Helpers::installLogDispatchCallback ( const std::string &  id)
inlinestatic

Installs post log dispatch callback, this callback is triggered when log is dispatched.

Definition at line 3769 of file easylogging++.h.

3769  {
3770  return ELPP->installLogDispatchCallback<T>(id);
3771  }
const uint32_t T[512]

◆ installPreRollOutCallback()

static void el::Helpers::installPreRollOutCallback ( const PreRollOutCallback callback)
inlinestatic

Installs pre rollout callback, this callback is triggered when log file is about to be rolled out (can be useful for backing up)

Definition at line 3760 of file easylogging++.h.

3760  {
3761  ELPP->setPreRollOutCallback(callback);
3762  }
Here is the caller graph for this function:

◆ logDispatchCallback()

template<typename T >
static T* el::Helpers::logDispatchCallback ( const std::string &  id)
inlinestatic

Definition at line 3778 of file easylogging++.h.

3778  {
3779  return ELPP->logDispatchCallback<T>(id);
3780  }

◆ reserveCustomFormatSpecifiers()

static void el::Helpers::reserveCustomFormatSpecifiers ( std::size_t  size)
inlinestatic

Reserve space for custom format specifiers for performance.

See also
std::vector::reserve

Definition at line 3824 of file easylogging++.h.

3824  {
3825  ELPP->m_customFormatSpecifiers.reserve(size);
3826  }

◆ setArgs() [1/2]

static void el::Helpers::setArgs ( int  argc,
char **  argv 
)
inlinestatic

Sets application arguments and figures out whats active for logging and whats not.

Definition at line 3726 of file easylogging++.h.

3726  {
3727  ELPP->setApplicationArguments(argc, argv);
3728  }

◆ setArgs() [2/2]

static void el::Helpers::setArgs ( int  argc,
const char **  argv 
)
inlinestatic

Sets application arguments and figures out whats active for logging and whats not.

Definition at line 3730 of file easylogging++.h.

3730  {
3731  ELPP->setApplicationArguments(argc, const_cast<char**>(argv));
3732  }

◆ setStorage()

static void el::Helpers::setStorage ( base::type::StoragePointer  storage)
inlinestatic

Shares logging repository (base::Storage)

Definition at line 3718 of file easylogging++.h.

3718  {
3719  ELPP = storage;
3720  }
static base::type::StoragePointer storage()

◆ setThreadName()

static void el::Helpers::setThreadName ( const std::string &  name)
inlinestatic

Sets thread name for current thread. Requires std::thread.

Definition at line 3734 of file easylogging++.h.

3734  {
3735  ELPP->setThreadName(name);
3736  }
const char * name

◆ storage()

static base::type::StoragePointer el::Helpers::storage ( )
inlinestatic
Returns
Main storage repository

Definition at line 3722 of file easylogging++.h.

3722  {
3723  return ELPP;
3724  }

◆ uninstallCustomFormatSpecifier()

static bool el::Helpers::uninstallCustomFormatSpecifier ( const char *  formatSpecifier)
inlinestatic

Uninstalls user defined format specifier and handler.

Definition at line 3832 of file easylogging++.h.

3832  {
3833  return ELPP->uninstallCustomFormatSpecifier(formatSpecifier);
3834  }

◆ uninstallLogDispatchCallback()

template<typename T >
static void el::Helpers::uninstallLogDispatchCallback ( const std::string &  id)
inlinestatic

Uninstalls log dispatch callback.

Definition at line 3774 of file easylogging++.h.

3774  {
3775  ELPP->uninstallLogDispatchCallback<T>(id);
3776  }

◆ uninstallPreRollOutCallback()

static void el::Helpers::uninstallPreRollOutCallback ( void  )
inlinestatic

Uninstalls pre rollout callback.

Definition at line 3764 of file easylogging++.h.

3764  {
3765  ELPP->unsetPreRollOutCallback();
3766  }

◆ validateFileRolling()

static void el::Helpers::validateFileRolling ( Logger logger,
Level  level 
)
inlinestatic

Definition at line 3839 of file easylogging++.h.

3839  {
3840  if (ELPP == nullptr || logger == nullptr) return;
3841  logger->m_typedConfigurations->validateFileRolling(level, ELPP->preRollOutCallback());
3842  }

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