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 class LogMessage : public String
40 {
41 public:
52
53 public:
55 : String()
56 , m_time(Constant<Time>::NaN)
57 , m_error_level(0)
58 {}
59 LogMessage(const Time& time, const char* message, const uint01 error_level = e_notification)
60 : String(message)
61 , m_time(time)
62 , m_error_level(error_level)
63 {
65 }
66 explicit LogMessage(const char* message, const uint01 error_level = e_notification)
67 : String(message)
68 , m_time(Time::SystemTime())
69 , m_error_level(error_level)
70 {
72 }
73 explicit LogMessage(const String& message, const uint01 error_level = e_notification)
74 : String(message)
75 , m_time(Time::SystemTime())
76 , m_error_level(error_level)
77 {
79 }
80 explicit LogMessage(const TranslatedString& message, const uint01 error_level = e_notification)
81 : String(message.translation())
82 , m_time(Time::SystemTime())
83 , m_error_level(error_level)
84 {
86 }
88 {
89 replace("\n", "\\n");
90 replace("\r", "\\r");
91 replace("\t", "\\t");
92 }
93 inline Time recordTime() const {
94 return m_time;
95 }
96 inline uint01 logRecordLevel() const {
97 return m_error_level;
98 }
99 protected:
102 };
103}
104
Definition LogMessage.h:40
LogMessage(const TranslatedString &message, const uint01 error_level=e_notification)
Definition LogMessage.h:80
void formatMessage()
Definition LogMessage.h:87
LogMessage(const char *message, const uint01 error_level=e_notification)
Definition LogMessage.h:66
Time recordTime() const
Definition LogMessage.h:93
LogMessage(const String &message, const uint01 error_level=e_notification)
Definition LogMessage.h:73
Time m_time
Definition LogMessage.h:100
LogMessage(const Time &time, const char *message, const uint01 error_level=e_notification)
Definition LogMessage.h:59
uint01 logRecordLevel() const
Definition LogMessage.h:96
ApplicationMessagePriority
Definition LogMessage.h:43
@ e_critical_error
Definition LogMessage.h:50
@ e_notification
Definition LogMessage.h:47
@ e_warning
Definition LogMessage.h:48
@ e_error
Definition LogMessage.h:49
@ e_debug
Definition LogMessage.h:45
@ e_logged_debug
Definition LogMessage.h:46
@ e_success
Definition LogMessage.h:44
uint01 m_error_level
Definition LogMessage.h:101
LogMessage()
Definition LogMessage.h:54
Definition String.h:40
NDEVR_BASE_API String & replace(const String &sub_string, const String &replace_sub_string, bool ignore_case=false)
Definition String.cpp:343
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:54
Definition TranslatedString.h:9
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:98
Definition BaseValues.hpp:272