Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
spdlog
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
spdlog
Commits
f9f59a54
Commit
f9f59a54
authored
10 years ago
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log_msg to contain logger_name + astyle
parent
d2178160
v1.x
file_event_handlers
master
v2.x
v1.9.2
v1.9.1
v1.9.0
v1.8.5
v1.8.4
v1.8.3
v1.8.2
v1.8.1
v1.8.0
v1.7.0
v1.6.1
v1.6.0
v1.5.0
v1.4.2
v1.4.1
v1.4.0
v1.3.1
v1.3.0
v1.2.1
v1.2.0
v1.1.0
v1.0.0
v0.17.0
v0.16.3
v0.16.2
v0.16.1
v0.16.0
v0.14.0
v0.13.0
v0.12.0
v0.11.0
v0.10.0
v0.9.0
No related merge requests found
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
19 additions
and
19 deletions
+19
-19
include/c11log/details/fast_oss.h
include/c11log/details/fast_oss.h
+4
-2
include/c11log/details/flush_helper.h
include/c11log/details/flush_helper.h
+2
-2
include/c11log/details/line_logger.h
include/c11log/details/line_logger.h
+2
-1
include/c11log/details/log_msg.h
include/c11log/details/log_msg.h
+4
-0
include/c11log/details/stack_buf.h
include/c11log/details/stack_buf.h
+2
-9
include/c11log/formatter.h
include/c11log/formatter.h
+4
-4
include/c11log/logger.h
include/c11log/logger.h
+1
-1
No files found.
include/c11log/details/fast_oss.h
View file @
f9f59a54
...
...
@@ -21,7 +21,9 @@ public:
stack_devicebuf
(
const
stack_devicebuf
&
other
)
:
std
::
basic_streambuf
<
char
>
(),
_stackbuf
(
other
.
_stackbuf
)
{}
stack_devicebuf
(
stack_devicebuf
&&
other
)
:
std
::
basic_streambuf
<
char
>
(),
_stackbuf
(
std
::
move
(
other
.
_stackbuf
))
stack_devicebuf
(
stack_devicebuf
&&
other
)
:
std
::
basic_streambuf
<
char
>
(),
_stackbuf
(
std
::
move
(
other
.
_stackbuf
))
{
other
.
clear
();
}
...
...
@@ -102,4 +104,4 @@ private:
stack_devicebuf
_dev
;
};
}
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
include/c11log/details/flush_helper.h
View file @
f9f59a54
...
...
@@ -12,8 +12,8 @@ public:
explicit
file_flush_helper
(
const
std
::
size_t
flush_every
)
:
_flush_every
(
flush_every
),
_flush_countdown
(
flush_every
)
{};
void
write
(
const
std
::
string
&
msg
,
std
::
ofstream
&
ofs
)
void
write
(
const
std
::
string
&
msg
,
std
::
ofstream
&
ofs
)
{
ofs
.
write
(
msg
.
data
(),
msg
.
size
());
if
(
--
_flush_countdown
==
0
)
...
...
This diff is collapsed.
Click to expand it.
include/c11log/details/line_logger.h
View file @
f9f59a54
...
...
@@ -46,7 +46,8 @@ public:
{
if
(
_enabled
)
{
_log_msg
.
time
=
log_clock
::
now
();
_log_msg
.
logger_name
=
_callback_logger
->
get_name
();
_log_msg
.
time
=
log_clock
::
now
();
_log_msg
.
raw
=
_oss
.
str
();
_callback_logger
->
_log_it
(
_log_msg
);
}
...
...
This diff is collapsed.
Click to expand it.
include/c11log/details/log_msg.h
View file @
f9f59a54
...
...
@@ -8,6 +8,7 @@ struct log_msg
{
log_msg
()
=
default
;
log_msg
(
level
::
level_enum
l
)
:
logger_name
(),
level
(
l
),
time
(),
raw
(),
...
...
@@ -15,6 +16,7 @@ struct log_msg
log_msg
(
const
log_msg
&
other
)
:
logger_name
(
other
.
logger_name
),
level
(
other
.
level
),
time
(
other
.
time
),
raw
(
other
.
raw
),
...
...
@@ -28,6 +30,7 @@ struct log_msg
friend
void
swap
(
log_msg
&
l
,
log_msg
&
r
)
{
using
std
::
swap
;
swap
(
l
.
logger_name
,
r
.
logger_name
);
swap
(
l
.
level
,
r
.
level
);
swap
(
l
.
time
,
r
.
time
);
swap
(
l
.
raw
,
r
.
raw
);
...
...
@@ -48,6 +51,7 @@ struct log_msg
formatted
.
clear
();
}
std
::
string
logger_name
;
level
::
level_enum
level
;
log_clock
::
time_point
time
;
std
::
string
raw
;
...
...
This diff is collapsed.
Click to expand it.
include/c11log/details/stack_buf.h
View file @
f9f59a54
...
...
@@ -5,9 +5,7 @@
#include <algorithm>
#include <cstring>
// Fast memory storage
// stores its contents on the stack when possible, in vector<char> otherwise
// NOTE: User should be remember that returned buffer might be on the stack!!
// Fast memory storage on the stack when possible or in std::vector
namespace
c11log
{
namespace
details
...
...
@@ -24,11 +22,6 @@ public:
stack_buf
&
operator
=
(
const
stack_buf
&
other
)
=
delete
;
stack_buf
(
const
bufpair_t
&
buf_to_copy
)
:
stack_buf
()
{
append
(
buf_to_copy
);
}
stack_buf
(
const
stack_buf
&
other
)
{
_stack_size
=
other
.
_stack_size
;
...
...
@@ -108,4 +101,4 @@ private:
};
}
}
//namespace c11log { namespace details {
\ No newline at end of file
}
//namespace c11log { namespace details {
This diff is collapsed.
Click to expand it.
include/c11log/formatter.h
View file @
f9f59a54
...
...
@@ -22,7 +22,7 @@ namespace formatters
class
formatter
{
public:
virtual
void
format
(
const
std
::
string
&
logger_name
,
details
::
log_msg
&
msg
)
=
0
;
virtual
void
format
(
details
::
log_msg
&
msg
)
=
0
;
};
...
...
@@ -30,12 +30,12 @@ class default_formatter: public formatter
{
public:
// Format: [2013-12-29 01:04:42.900] [logger_name:Info] Message body
void
format
(
const
std
::
string
&
logger_name
,
details
::
log_msg
&
msg
)
override
void
format
(
details
::
log_msg
&
msg
)
override
{
details
::
fast_oss
oss
;
_format_time
(
msg
.
time
,
oss
);
if
(
!
logger_name
.
empty
())
oss
<<
" ["
<<
logger_name
<<
':'
<<
c11log
::
level
::
to_str
(
msg
.
level
)
<<
"] "
;
if
(
!
msg
.
logger_name
.
empty
())
oss
<<
" ["
<<
msg
.
logger_name
<<
':'
<<
c11log
::
level
::
to_str
(
msg
.
level
)
<<
"] "
;
else
oss
<<
" ["
<<
c11log
::
level
::
to_str
(
msg
.
level
)
<<
"] "
;
oss
<<
msg
.
raw
<<
details
::
os
::
eol
();
...
...
This diff is collapsed.
Click to expand it.
include/c11log/logger.h
View file @
f9f59a54
...
...
@@ -209,7 +209,7 @@ inline bool c11log::logger::should_log(c11log::level::level_enum level) const
inline
void
c11log
::
logger
::
_log_it
(
details
::
log_msg
&
msg
)
{
_formatter
->
format
(
_logger_name
,
msg
);
_formatter
->
format
(
msg
);
for
(
auto
&
sink
:
_sinks
)
sink
->
log
(
msg
);
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment