Electroneum
Loading...
Searching...
No Matches
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).
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.
static void setArgs (int argc, const char **argv)
 Sets application arguments and figures out whats active for logging and whats not.
static void setThreadName (const std::string &name)
 Sets thread name for current thread. Requires std::thread.
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).
static void uninstallPreRollOutCallback (void)
 Uninstalls pre rollout callback.
template<typename T>
static bool installLogDispatchCallback (const std::string &id)
 Installs post log dispatch callback, this callback is triggered when log is dispatched.
template<typename T>
static void uninstallLogDispatchCallback (const std::string &id)
 Uninstalls log dispatch callback.
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.
static const el::base::utils::CommandLineArgscommandLineArgs (void)
 Returns command line arguments (pointer) provided to easylogging++.
static void reserveCustomFormatSpecifiers (std::size_t size)
 Reserve space for custom format specifiers for performance.
static void installCustomFormatSpecifier (const CustomFormatSpecifier &customFormatSpecifier)
 Installs user defined format specifier and handler.
static bool uninstallCustomFormatSpecifier (const char *formatSpecifier)
 Uninstalls user defined format specifier and handler.
static bool hasCustomFormatSpecifier (const char *formatSpecifier)
 Returns true if custom format specifier is installed.
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()

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>
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 }
virtual void acquireLock(void) ELPP_FINAL
virtual void releaseLock(void) ELPP_FINAL
#define ELPP_LITERAL(txt)
Here is the call graph for this function:

◆ getThreadName()

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

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

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

◆ hasCustomFormatSpecifier()

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()

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>
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 }
#define T(x)

◆ installPreRollOutCallback()

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>
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()

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]

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]

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()

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()
Here is the call graph for this function:

◆ setThreadName()

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 }

◆ storage()

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

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

3722 {
3723 return ELPP;
3724 }
Here is the caller graph for this function:

◆ uninstallCustomFormatSpecifier()

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>
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()

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

Uninstalls pre rollout callback.

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

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

◆ validateFileRolling()

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:
  • /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/external/easylogging++/easylogging++.h