Electroneum
el::base::utils::OS Class Reference

Operating System helper static class used internally. You should not use it. More...

#include <easylogging++.h>

Inheritance diagram for el::base::utils::OS:
Collaboration diagram for el::base::utils::OS:

Static Public Member Functions

static const std::string getBashOutput (const char *command)
 Runs command on terminal and returns the output. More...
 
static std::string getEnvironmentVariable (const char *variableName, const char *defaultVal, const char *alternativeBashCommand=nullptr)
 Gets environment variable. This is cross-platform and CRT safe (for VC++) More...
 
static std::string currentUser (void)
 Gets current username. More...
 
static std::string currentHost (void)
 Gets current host name or computer name. More...
 
static bool termSupportsColor (void)
 Whether or not terminal supports colors. More...
 

Detailed Description

Operating System helper static class used internally. You should not use it.

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

Member Function Documentation

◆ currentHost()

static std::string el::base::utils::OS::currentHost ( void  )
static

Gets current host name or computer name.

For android systems this is device name with its manufacturer and model seperated by hyphen

◆ currentUser()

static std::string el::base::utils::OS::currentUser ( void  )
static

Gets current username.

◆ getBashOutput()

static const std::string el::base::utils::OS::getBashOutput ( const char *  command)
static

Runs command on terminal and returns the output.

This is applicable only on unix based systems, for all other OS, an empty string is returned.

Parameters
commandBash command
Returns
Result of bash output or empty string if no result found.

◆ getEnvironmentVariable()

static std::string el::base::utils::OS::getEnvironmentVariable ( const char *  variableName,
const char *  defaultVal,
const char *  alternativeBashCommand = nullptr 
)
static

Gets environment variable. This is cross-platform and CRT safe (for VC++)

Parameters
variableNameEnvironment variable name
defaultValIf no environment variable or value found the value to return by default
alternativeBashCommandIf environment variable not found what would be alternative bash command in order to look for value user is looking for. E.g, for 'user' alternative command will 'whoami'

◆ termSupportsColor()

static bool el::base::utils::OS::termSupportsColor ( void  )
static

Whether or not terminal supports colors.


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