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
a7f04690
Commit
a7f04690
authored
Oct 12, 2014
by
gabi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added bench and example files
parent
f9425bb6
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
47 deletions
+38
-47
c11logtest.vcxproj
c11logtest/c11logtest/c11logtest.vcxproj
+2
-1
c11logtest.vcxproj.filters
c11logtest/c11logtest/c11logtest.vcxproj.filters
+10
-6
bench.cpp
example/bench.cpp
+7
-7
example.cpp
example/example.cpp
+19
-33
No files found.
c11logtest/c11logtest/c11logtest.vcxproj
View file @
a7f04690
...
...
@@ -86,7 +86,6 @@
<ItemGroup>
<ClInclude
Include=
"..\..\include\c11log\common.h"
/>
<ClInclude
Include=
"..\..\include\c11log\details\blocking_queue.h"
/>
<ClInclude
Include=
"..\..\include\c11log\details\factory.h"
/>
<ClInclude
Include=
"..\..\include\c11log\details\fast_oss.h"
/>
<ClInclude
Include=
"..\..\include\c11log\details\flush_helper.h"
/>
<ClInclude
Include=
"..\..\include\c11log\details\line_logger.h"
/>
...
...
@@ -94,6 +93,7 @@
<ClInclude
Include=
"..\..\include\c11log\details\null_mutex.h"
/>
<ClInclude
Include=
"..\..\include\c11log\details\os.h"
/>
<ClInclude
Include=
"..\..\include\c11log\details\stack_buf.h"
/>
<ClInclude
Include=
"..\..\include\c11log\factory.h"
/>
<ClInclude
Include=
"..\..\include\c11log\formatter.h"
/>
<ClInclude
Include=
"..\..\include\c11log\logger.h"
/>
<ClInclude
Include=
"..\..\include\c11log\sinks\async_sink.h"
/>
...
...
@@ -107,6 +107,7 @@
<ClInclude
Include=
"targetver.h"
/>
</ItemGroup>
<ItemGroup>
<ClCompile
Include=
"..\..\example\bench.cpp"
/>
<ClCompile
Include=
"..\..\example\example.cpp"
/>
<ClCompile
Include=
"stdafx.cpp"
/>
</ItemGroup>
...
...
c11logtest/c11logtest/c11logtest.vcxproj.filters
View file @
a7f04690
...
...
@@ -69,12 +69,6 @@
<ClInclude
Include=
"..\..\include\c11log\sinks\file_sinks.h"
>
<Filter>
Header Files\c11log\sinks
</Filter>
</ClInclude>
<ClInclude
Include=
"..\..\include\c11log\details\factory.h"
>
<Filter>
Header Files\c11log\details
</Filter>
</ClInclude>
<ClInclude
Include=
"..\..\include\c11log\sinks\isink.h"
>
<Filter>
Header Files
</Filter>
</ClInclude>
<ClInclude
Include=
"..\..\include\c11log\details\null_mutex.h"
>
<Filter>
Header Files\c11log\details
</Filter>
</ClInclude>
...
...
@@ -90,6 +84,12 @@
<ClInclude
Include=
"..\..\include\c11log\common.h"
>
<Filter>
Header Files\c11log
</Filter>
</ClInclude>
<ClInclude
Include=
"..\..\include\c11log\sinks\isink.h"
>
<Filter>
Header Files\c11log\sinks
</Filter>
</ClInclude>
<ClInclude
Include=
"..\..\include\c11log\factory.h"
>
<Filter>
Header Files\c11log
</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile
Include=
"stdafx.cpp"
>
...
...
@@ -98,5 +98,8 @@
<ClCompile
Include=
"..\..\example\example.cpp"
>
<Filter>
Source Files
</Filter>
</ClCompile>
<ClCompile
Include=
"..\..\example\bench.cpp"
>
<Filter>
Source Files
</Filter>
</ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file
example/bench.cpp
View file @
a7f04690
...
...
@@ -15,26 +15,26 @@ using namespace c11log;
using
namespace
utils
;
int
main
(
int
argc
,
char
*
argv
[])
int
main
2
(
int
argc
,
char
*
argv
[])
{
const
unsigned
int
howmany
=
argc
<=
1
?
10000
:
atoi
(
argv
[
1
]);
const
unsigned
int
howmany
=
argc
<=
1
?
10000
00
:
atoi
(
argv
[
1
]);
logger
cout_logger
(
"example"
,
std
::
make_shared
<
sinks
::
stderr_sink_mt
>
());
cout_logger
.
info
()
<<
"Hello logger"
;
//auto nullsink = std::make_shared<sinks::null_sink<std::mutex>>();
auto
nullsink
=
std
::
make_shared
<
sinks
::
null_sink
<
details
::
null_mutex
>>
();
auto
fsink
=
std
::
make_shared
<
sinks
::
rotating_file_sink_st
>
(
"log"
,
"txt"
,
1024
*
1024
*
50
,
5
,
10
);
auto
as
=
std
::
make_shared
<
sinks
::
async_sink
>
(
1000
);
logger
my_logger
(
"my_logger"
,
fsink
);
logger
my_logger
(
"my_logger"
,
nullsink
);
auto
start
=
system_clock
::
now
();
for
(
unsigned
int
i
=
1
;
i
<=
howmany
;
++
i
)
my_logger
.
info
()
<<
"Hello logger: msg #"
<<
i
;
my_logger
.
info
()
<<
"Hello logger: msg #"
<<
i
<<
1
<<
2
<<
3
<<
4
<<
5
<<
6
<<
7
<<
8
<<
9
<<
10
<<
11
<<
12
<<
13
<<
14
<<
15
<<
16
<<
17
<<
18
<<
19
;
//my_logger.info("Hello logger: msg #",i,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19);
auto
delta
=
system_clock
::
now
()
-
start
;
...
...
example/example.cpp
View file @
a7f04690
// example.cpp : Simple logger example
//
#include <mutex>
#define FFLOG_ENABLE_TRACE
#include <iostream>
#include "c11log/logger.h"
#include "c11log/sinks/async_sink.h"
#include "c11log/sinks/file_sinks.h"
#include "c11log/factory.h"
#include "c11log/sinks/stdout_sinks.h"
#include "c11log/sinks/null_sink.h"
#include "utils.h"
using
std
::
cout
;
using
std
::
endl
;
using
namespace
std
::
chrono
;
using
namespace
c11log
;
using
namespace
utils
;
#include "c11log/sinks/file_sinks.h"
using
namespace
std
;
int
main
(
int
argc
,
char
*
argv
[])
{
const
unsigned
int
howmany
=
argc
<=
1
?
10000
:
atoi
(
argv
[
1
]);
logger
cout_logger
(
"example"
,
std
::
make_shared
<
sinks
::
stderr_sink_mt
>
());
cout_logger
.
info
()
<<
"Hello logger"
;
//auto nullsink = std::make_shared<sinks::null_sink<std::mutex>>();
auto
nullsink
=
std
::
make_shared
<
sinks
::
null_sink
<
details
::
null_mutex
>>
();
auto
fsink
=
std
::
make_shared
<
sinks
::
rotating_file_sink_st
>
(
"log"
,
"txt"
,
1024
*
1024
*
50
,
5
,
10
);
auto
as
=
std
::
make_shared
<
sinks
::
async_sink
>
(
1000
);
logger
my_logger
(
"my_logger"
,
fsink
);
auto
console
=
c11log
::
factory
::
stdout_logger
();
auto
file
=
c11log
::
factory
::
simple_file_logger
(
"log.txt"
);
auto
rotating
=
c11log
::
factory
::
rotating_file_logger
(
"myrotating"
,
"txt"
,
1024
*
1024
*
5
,
5
,
1
);
auto
daily
=
c11log
::
factory
::
daily_file_logger
(
"dailylog"
,
"txt"
,
1
,
"daily_logger"
);
auto
start
=
system_clock
::
now
();
for
(
unsigned
int
i
=
1
;
i
<=
howmany
;
++
i
)
my_logger
.
info
()
<<
"Hello logger: msg #"
<<
i
;
//console->info() << "This is variadic ", " func, ", 123 << " YES";
FFLOG_TRACE
(
console
,
"This is "
,
1
);
auto
delta
=
system_clock
::
now
()
-
start
;
auto
delta_d
=
duration_cast
<
duration
<
double
>>
(
delta
).
count
();
file
->
info
(
"Hello file log"
);
rotating
->
info
(
"Hello rotating log"
);
daily
->
info
(
"Hello daily log"
);
cout
<<
"Total:"
<<
format
(
howmany
)
<<
endl
;
cout
<<
"Delta:"
<<
format
(
delta_d
)
<<
endl
;
cout
<<
"Rate:"
<<
format
(
howmany
/
delta_d
)
<<
"/sec"
<<
endl
;
//multi sink logger: file + console
auto
sink1
=
std
::
make_shared
<
c11log
::
sinks
::
stdout_sink_mt
>
();
auto
sink2
=
std
::
make_shared
<
c11log
::
sinks
::
daily_file_sink_mt
>
(
"rotating"
,
"txt"
);
c11log
::
logger
combined
(
"combined"
,
{
sink1
,
sink2
});
return
0
;
}
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