Sese Framework
2.3.0
A cross-platform framework
Loading...
Searching...
No Matches
Event.h
Go to the documentation of this file.
1
// Copyright 2024 libsese
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
22
#pragma once
23
24
#include "
sese/Config.h
"
25
#include "
sese/util/DateTime.h
"
26
#include <memory>
27
#include <utility>
28
29
#ifdef _WIN32
30
#pragma warning(disable : 4251)
31
#pragma warning(disable : 4819)
32
#endif
33
namespace
sese::record
{
34
36
enum class
Level
{
37
DEBUG
= 0,
38
INFO
= 1,
39
WARN
= 2,
40
ERR
= 3
41
};
42
46
class
Event
{
47
public
:
48
typedef
std::shared_ptr<Event>
Ptr
;
49
50
public
:
51
Event
(
DateTime
date_time,
Level
lv, std::string thread_name,
tid_t
id
, std::string
file
, int32_t
line
,
52
std::string msg)
noexcept
{
53
this->
dateTime
= date_time;
54
this->
level
= lv;
55
this->
threadName
= std::move(thread_name);
56
this->
threadId
= id;
57
this->
file
= std::move(
file
);
58
this->
line
=
line
;
59
this->
message
= std::move(msg);
60
}
61
62
[[nodiscard]]
const
DateTime
&
getTime
() const noexcept {
return
this->
dateTime
; }
63
[[nodiscard]]
Level
getLevel
() const noexcept {
return
this->
level
; }
64
[[nodiscard]]
tid_t
getThreadId
() const noexcept {
return
this->
threadId
; }
65
[[nodiscard]] int32_t
getLine
() const noexcept {
return
this->
line
; }
66
[[nodiscard]]
auto
&
getFileName
() const noexcept {
return
this->
file
; }
67
[[nodiscard]]
auto
&
getMessage
() const noexcept {
return
this->
message
; }
68
[[nodiscard]]
auto
&
getThreadName
() const noexcept {
return
this->
threadName
; }
69
70
private
:
71
DateTime
dateTime
;
72
Level
level
;
73
std::string
threadName
;
74
tid_t
threadId
;
75
std::string
file
;
76
int32_t
line
;
77
std::string
message
;
78
};
79
}
// namespace sese::record
sese
record
Event.h
Generated on Tue Jan 7 2025 15:49:06 for Sese Framework by
1.11.0