Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
spdlog
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
spdlog
Commits
e5f47904
Commit
e5f47904
authored
Oct 25, 2014
by
gabi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fixes
parent
b94ca27c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
11 deletions
+8
-11
bench.cpp
example/bench.cpp
+4
-4
logger_impl.h
include/c11log/details/logger_impl.h
+2
-1
os.h
include/c11log/details/os.h
+1
-1
pattern_formatter_impl.h
include/c11log/details/pattern_formatter_impl.h
+1
-5
No files found.
example/bench.cpp
View file @
e5f47904
...
...
@@ -24,14 +24,14 @@ int main(int argc, char* argv[])
console
->
set_level
(
c11log
::
level
::
INFO
);
console
->
info
(
"Starting bench with"
,
howmany
,
"iterations.."
);
//
auto bench = c11log::create<sinks::rotating_file_sink_st>("bench", "myrotating", "txt", 1024 * 1024 * 5, 3, 0);
auto
bench
=
c11log
::
create
<
sinks
::
daily_file_sink_mt
>
(
"bench"
,
"sdfsfddaily"
,
"txt"
,
0
);
auto
bench
=
c11log
::
create
<
sinks
::
rotating_file_sink_st
>
(
"bench"
,
"myrotating"
,
"txt"
,
1024
*
1024
*
5
,
3
,
0
);
//auto bench = c11log::create<sinks::simple_file_sink_st>("bench", "simplelog.txt", 1);
//auto bench = c11log::create<sinks::null_sink_st>("bench");
auto
start
=
system_clock
::
now
();
for
(
unsigned
int
i
=
1
;
i
<=
howmany
;
++
i
)
for
(
unsigned
int
i
=
0
;
i
<
howmany
;
++
i
)
{
c11log
::
get
(
"bench"
)
->
info
(
"Hello logger: msg number"
,
i
)
;
bench
->
info
(
"Hello logger: msg number"
)
<<
i
;
}
auto
delta
=
system_clock
::
now
()
-
start
;
...
...
include/c11log/details/logger_impl.h
View file @
e5f47904
...
...
@@ -115,8 +115,9 @@ void c11log::logger::_variadic_log(c11log::details::line_logger& l, const First&
inline
void
c11log
::
logger
::
_log_msg
(
details
::
log_msg
&
msg
)
{
//Use default formatter if not set
if
(
!
_formatter
)
_formatter
=
std
::
make_shared
<
pattern_formatter
>
(
"%+
%t
"
);
_formatter
=
std
::
make_shared
<
pattern_formatter
>
(
"%+"
);
_formatter
->
format
(
msg
);
for
(
auto
&
sink
:
_sinks
)
sink
->
log
(
msg
);
...
...
include/c11log/details/os.h
View file @
e5f47904
...
...
@@ -93,7 +93,7 @@ constexpr inline unsigned short eol_size()
#endif
//fopen_s on non windows for writing
inline
bool
fopen_s
(
FILE
**
fp
,
const
std
::
string
&
filename
,
const
char
*
mode
)
inline
int
fopen_s
(
FILE
**
fp
,
const
std
::
string
&
filename
,
const
char
*
mode
)
{
#ifdef _WIN32
return
::
fopen_s
(
fp
,
filename
.
c_str
(),
mode
);
...
...
include/c11log/details/pattern_formatter_impl.h
View file @
e5f47904
...
...
@@ -366,11 +366,7 @@ class full_formatter :public flag_formatter
auto
millis
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
duration
).
count
()
%
1000
;
msg
.
formatted
.
put_int
(
static_cast
<
int
>
(
millis
),
3
);
msg
.
formatted
.
putc
(
']'
);
msg
.
formatted
<<
" ["
;
msg
.
formatted
<<
msg
.
logger_name
;
msg
.
formatted
<<
"] ["
;
msg
.
formatted
<<
level
::
to_str
(
msg
.
level
);
msg
.
formatted
<<
"] "
;
msg
.
formatted
<<
" ["
<<
msg
.
logger_name
<<
"] ["
<<
level
::
to_str
(
msg
.
level
)
<<
"] "
;
msg
.
formatted
.
put_fast_oss
(
msg
.
raw
);
}
...
...
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