UTILLib 2.0
Common C++ library with utilities.
|
The log namespace is used for log related classes and functions. More...
Classes | |
class | IDirectory |
The class is simple wrapper around a directory/file tree structure. It is typically used in applications that needs to keep track of file changes in a root directory. More... | |
class | IFile |
Class that wraps a file object in a directory. More... | |
class | IListen |
An interface class that hides the actual implementation of the object. More... | |
class | IListenClient |
Class that define a TCP/IP client. More... | |
class | ILogger |
Interface against a generic logger. More... | |
class | ListenConfig |
Implement the shared memory list of listen server configurations. More... | |
struct | ListenPortConfig |
Defines a listen config item in the config memory. More... | |
class | ListenStream |
Support stream class when log messages to the listen functionality. More... | |
class | LogConfig |
Singleton class that is used for configure the default logger in an application. More... | |
struct | LogMessage |
class | LogStream |
This class implements a stream interface around a log message. More... | |
class | TempDir |
class | ThreadSafeQueue |
Implements a thread-safe queue. More... |
Typedefs | |
using | DirectoryList = std::map<std::string, std::unique_ptr<IDirectory>> |
Sorted list of directories. | |
using | FileList = std::map<std::string, std::unique_ptr<IFile>> |
Sorted list of files in the directory. | |
using | FilterList = std::vector<std::string> |
List of name filters. | |
using | Loc = std::experimental::source_location |
Enumerations | |
enum class | TypeOfListen { ListenProxyType = 0 , ListenServerType , ListenConsoleType } |
Defines the type of listen objects. More... | |
enum class | LogType { LogNothing = 0 , LogToConsole , LogToFile , LogToListen , LogToSyslog } |
enum class | LogSeverity : uint8_t { kTrace = 0 , kDebug , kInfo , kNotice , kWarning , kError , kCritical , kAlert , kEmergency } |
< Defines the log severity level More... |
Functions | |
std::vector< ListenPortConfig > | GetListenConfigList () |
Returns the list of available listen servers. | |
void | AddListenConfig (const ListenPortConfig &port_config) |
Register a new listen server. | |
void | DeleteListenConfig (uint16_t port) |
Removes a listen server from the list. | |
std::string | ProgramDataPath () |
void | LogDebug (const Loc &loc, const char *fmt,...) |
Creates a debug message message. | |
void | LogInfo (const Loc &loc, const char *fmt,...) |
Creates an information message. | |
void | LogError (const Loc &loc, const char *fmt,...) |
Creates an error message. | |
void | LogString (const Loc &loc, LogSeverity severity, const std::string &message) |
Creates a generic message. | |
std::string | FindNotepad () |
Search and returns the path to the Notepad application.. Search primary for the Notepad++ application and second for the Notepad application. | |
bool | BackupFiles (const std::string &filename, bool remove_file=true) |
Backup up a file with the 9 last changes. | |
std::string | GetSeverityString (LogSeverity severity) |
Returns the log level as a string. |
The log namespace is used for all log related classes and functions.
using util::log::DirectoryList = std::map<std::string, std::unique_ptr<IDirectory>> |
A list of sub-directories of the IDirectory class. The key (first) is the name of the directory without path and the value (second) is a unique pointer to the directory object.
using util::log::FileList = std::map<std::string, std::unique_ptr<IFile>> |
Sorted list of files in the directory. Note that the key (first) is the filename without path.
using util::log::FilterList = std::vector<std::string> |
List of name filters. Files are typical filtered by its extension for example '*.txt' while directories are filtered by its name for example 'obj'.
using util::log::Loc = std::experimental::source_location |
The Loc is a wrapper around the std::location library. This library is new in C++20.
|
strong |
|
strong |
|
strong |
void util::log::AddListenConfig | ( | const ListenPortConfig & | port_config | ) |
Add a new listen server onto the shared memory list of servers. Note that the port should be unique.
port_config | Server configuration. |
bool util::log::BackupFiles | ( | const std::string & | filename, |
bool | remove_file = true ) |
Backup a file by adding a sequence number 0..9 to the file (file_N.ext).
filename | Full path to the file. |
remove_file | If set to true the file will be renamed to file_0. If set to false the file will copy its content to file_0. The latter is slower but safer. |
void util::log::DeleteListenConfig | ( | uint16_t | port | ) |
Removes a listen server from the shared memory list.
port | TCP/IP port of the server. |
std::string util::log::FindNotepad | ( | ) |
|
nodiscard |
Returns a list of available listen servers on the computer.
std::string util::log::ProgramDataPath | ( | ) |
Utility function that returns the default program data path