API Documentation
Loading...
Searching...
No Matches
LogMessage.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Base
28File: LogMessage
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/Time.h>
34#include <NDEVR/String.h>
35#include <NDEVR/TranslatedString.h>
36
37namespace NDEVR
38{
39 /**--------------------------------------------------------------------------------------------------
40 \brief A class that allows for specific log information to be conveyed to a ProgressInfo object
41 including information about severity and timestamp information
42 **/
43 class LogMessage : public String
44 {
45 public:
56
57 public:
59 : String()
61 , m_error_level(0)
62 {}
63 LogMessage(const Time& time, const char* message, const uint01 error_level = e_notification)
64 : String(message)
65 , m_time(time)
66 , m_error_level(error_level)
67 {
69 }
70 explicit LogMessage(const char* message, const uint01 error_level = e_notification)
71 : String(message)
72 , m_time(Time::SystemTime())
73 , m_error_level(error_level)
74 {
76 }
77 explicit LogMessage(const String& message, const uint01 error_level = e_notification)
78 : String(message)
79 , m_time(Time::SystemTime())
80 , m_error_level(error_level)
81 {
83 }
84 explicit LogMessage(const TranslatedString& message, const uint01 error_level = e_notification)
85 : String(message.translation())
86 , m_time(Time::SystemTime())
87 , m_error_level(error_level)
88 {
90 }
92 {
93 replace("\n", "\\n");
94 replace("\r", "\\r");
95 replace("\t", "\\t");
96 }
97 inline Time recordTime() const {
98 return m_time;
99 }
100 inline uint01 logRecordLevel() const {
101 return m_error_level;
102 }
103 protected:
106 };
107}
108
A class that allows for specific log information to be conveyed to a ProgressInfo object including in...
Definition LogMessage.h:44
LogMessage(const TranslatedString &message, const uint01 error_level=e_notification)
Definition LogMessage.h:84
void formatMessage()
Definition LogMessage.h:91
LogMessage(const char *message, const uint01 error_level=e_notification)
Definition LogMessage.h:70
Time recordTime() const
Definition LogMessage.h:97
LogMessage(const String &message, const uint01 error_level=e_notification)
Definition LogMessage.h:77
Time m_time
Definition LogMessage.h:104
LogMessage(const Time &time, const char *message, const uint01 error_level=e_notification)
Definition LogMessage.h:63
uint01 logRecordLevel() const
Definition LogMessage.h:100
ApplicationMessagePriority
Definition LogMessage.h:47
@ e_critical_error
Definition LogMessage.h:54
@ e_notification
Definition LogMessage.h:51
@ e_warning
Definition LogMessage.h:52
@ e_error
Definition LogMessage.h:53
@ e_debug
Definition LogMessage.h:49
@ e_logged_debug
Definition LogMessage.h:50
@ e_success
Definition LogMessage.h:48
uint01 m_error_level
Definition LogMessage.h:105
LogMessage()
Definition LogMessage.h:58
The core String class for the NDEVR API.
Definition String.h:69
String & replace(const String &sub_string, const String &replace_sub_string, bool ignore_case=false)
Replaces ALL instances of a given substring with the provided replacement.
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:54
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
Definition TranslatedString.h:13
Definition ACIColor.h:37
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:80
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
Definition BaseValues.hpp:233