UTILLib 2.0
Common C++ library with utilities.
Loading...
Searching...
No Matches
logging.h
Go to the documentation of this file.
1/*
2 * Copyright 2021 Ingemar Hedvall
3 * SPDX-License-Identifier: MIT
4 */
5
9#pragma once
10#include <cstdint>
11#include <string>
12
13#if __has_include(<source_location>)
14#include <source_location>
15#else
16#include <experimental/source_location>
17#endif
18
19namespace util::log {
32
37
38#if __has_include(<source_location>)
39using Loc = std::source_location;
40#else
41using Loc = std::experimental::source_location;
42#endif
43
44void LogDebug(const Loc &loc, const char *fmt,
45 ...);
46void LogInfo(const Loc &loc, const char *fmt,
47 ...);
48void LogError(const Loc &loc, const char *fmt,
49 ...);
50void LogString(const Loc &loc, LogSeverity severity,
51 const std::string &message);
52
58std::string FindNotepad();
59
69bool BackupFiles(const std::string &filename, bool remove_file = true);
70
71} // namespace util::log
The log namespace is used for log related classes and functions.
Definition idirectory.h:18
std::experimental::source_location Loc
Definition logging.h:41
void LogDebug(const Loc &loc, const char *fmt,...)
Creates a debug message message.
void LogError(const Loc &loc, const char *fmt,...)
Creates an error message.
LogSeverity
< Defines the log severity level
Definition logging.h:21
@ kInfo
Informational message.
Definition logging.h:24
@ kEmergency
Fatal error message.
Definition logging.h:30
@ kCritical
Critical message (device error)
Definition logging.h:28
@ kNotice
Notice message. Notify the user.
Definition logging.h:25
@ kDebug
Debug message.
Definition logging.h:23
@ kAlert
Alert or alarm message.
Definition logging.h:29
@ kError
Error message.
Definition logging.h:27
@ kWarning
Warning message.
Definition logging.h:26
@ kTrace
Trace or listen message.
Definition logging.h:22
bool BackupFiles(const std::string &filename, bool remove_file=true)
Backup up a file with the 9 last changes.
std::string FindNotepad()
Search and returns the path to the Notepad application.. Search primary for the Notepad++ application...
void LogString(const Loc &loc, LogSeverity severity, const std::string &message)
Creates a generic message.
void LogInfo(const Loc &loc, const char *fmt,...)
Creates an information message.