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
32a8b51d
Commit
32a8b51d
authored
Oct 18, 2014
by
gabi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pattern_formatter support most strftime format
parent
0c6a0d52
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
34 additions
and
14 deletions
+34
-14
bench.cpp
example/bench.cpp
+6
-4
fast_istostr.h
include/c11log/details/fast_istostr.h
+1
-1
fast_oss.h
include/c11log/details/fast_oss.h
+5
-0
line_logger.h
include/c11log/details/line_logger.h
+1
-2
log_msg.h
include/c11log/details/log_msg.h
+1
-1
os.h
include/c11log/details/os.h
+14
-0
pattern_formatter.h
include/c11log/details/pattern_formatter.h
+0
-0
async_sink.h
include/c11log/sinks/async_sink.h
+1
-1
base_sink.h
include/c11log/sinks/base_sink.h
+1
-1
file_sinks.h
include/c11log/sinks/file_sinks.h
+1
-1
null_sink.h
include/c11log/sinks/null_sink.h
+1
-1
ostream_sink.h
include/c11log/sinks/ostream_sink.h
+1
-1
stdout_sinks.h
include/c11log/sinks/stdout_sinks.h
+1
-1
No files found.
example/bench.cpp
View file @
32a8b51d
...
...
@@ -17,16 +17,18 @@ int main(int argc, char* argv[])
{
const
unsigned
int
howmany
=
argc
<=
1
?
500000
:
atoi
(
argv
[
1
]);
//std::string pattern = "%Y:%m:%d %H:%M:%S.%e ---> [%n:%l] %t";
//auto formatter = std::make_shared<details::pattern_formatter>(pattern);
//std::string pattern = "%B %d, %Y %H:%M:%S.%e **************[%n:%l] %t";
std
::
string
pattern
=
" [%z] %t"
;
auto
formatter
=
std
::
make_shared
<
details
::
pattern_formatter
>
(
pattern
);
logger
cout_logger
(
"bench"
,
{
std
::
make_shared
<
sinks
::
stderr_sink_mt
>
()
});
cout_logger
.
formatter
(
formatter
);
cout_logger
.
info
()
<<
"Hello logger "
<<
1234
;
auto
nullsink
=
std
::
make_shared
<
sinks
::
null_sink_st
>
();
auto
rotating
=
std
::
make_shared
<
sinks
::
rotating_file_sink_mt
>
(
"myrotating"
,
"txt"
,
1024
*
1024
*
5
,
5
,
1
);
auto
rotating
=
std
::
make_shared
<
sinks
::
rotating_file_sink_mt
>
(
"myrotating"
,
"txt"
,
1024
*
1024
*
5
,
5
,
1
00
);
logger
my_logger
(
"my_logger"
,
{
rotating
}
);
logger
my_logger
(
"my_logger"
,
{
nullsink
},
formatter
);
auto
start
=
system_clock
::
now
();
for
(
unsigned
int
i
=
1
;
i
<=
howmany
;
++
i
)
...
...
include/c11log/details/fast_istostr.h
View file @
32a8b51d
...
...
@@ -26,7 +26,7 @@ inline std::string& fast_itostr(int n, std::string& s, int padding)
{
if
(
n
==
0
)
{
s
=
"0"
;
s
=
std
::
string
(
padding
,
'0'
)
;
return
s
;
}
...
...
include/c11log/details/fast_oss.h
View file @
32a8b51d
...
...
@@ -143,6 +143,11 @@ public:
_dev
.
sputn
(
s
.
data
(),
s
.
size
());
}
void
write_data
(
const
char
*
p
,
std
::
size_t
size
)
{
_dev
.
sputn
(
p
,
size
);
}
void
write_str
(
const
std
::
string
&
s
)
{
_dev
.
sputn
(
s
.
data
(),
s
.
size
());
...
...
include/c11log/details/line_logger.h
View file @
32a8b51d
#pragma once
#include <sstream>
#include "../common.h"
#include "../logger.h"
#include "fast_oss.h"
#include "
./
fast_oss.h"
// Line logger class - aggregates operator<< calls to fast ostream
...
...
include/c11log/details/log_msg.h
View file @
32a8b51d
#pragma once
#include "../common.h"
#include "fast_oss.h"
#include "
./
fast_oss.h"
namespace
c11log
{
...
...
include/c11log/details/os.h
View file @
32a8b51d
...
...
@@ -3,6 +3,9 @@
#include<string>
#include<cstdio>
#include<ctime>
#ifdef _WIN32
#include <Windows.h>
#endif
namespace
c11log
{
...
...
@@ -81,6 +84,17 @@ inline bool fopen_s(FILE** fp, const std::string& filename, const char* mode)
#endif
}
inline
float
tz_offset
()
{
#ifdef _WIN32
TIME_ZONE_INFORMATION
tzinfo
;
GetTimeZoneInformation
(
&
tzinfo
);
return
tzinfo
.
Bias
/
-
60
.
0
f
;
#else
return
0
.
0
f
;
#endif
}
}
//os
}
//details
...
...
include/c11log/details/pattern_formatter.h
View file @
32a8b51d
This diff is collapsed.
Click to expand it.
include/c11log/sinks/async_sink.h
View file @
32a8b51d
...
...
@@ -5,7 +5,7 @@
#include <atomic>
#include <algorithm>
#include "base_sink.h"
#include "
./
base_sink.h"
#include "../logger.h"
#include "../details/blocking_queue.h"
#include "../details/null_mutex.h"
...
...
include/c11log/sinks/base_sink.h
View file @
32a8b51d
...
...
@@ -3,7 +3,7 @@
#include<string>
#include<mutex>
#include<atomic>
#include "sink.h"
#include "
./
sink.h"
#include "../formatter.h"
#include "../common.h"
#include "../details/log_msg.h"
...
...
include/c11log/sinks/file_sinks.h
View file @
32a8b51d
...
...
@@ -3,7 +3,7 @@
#include <fstream>
#include <sstream>
#include <iomanip>
#include "base_sink.h"
#include "
./
base_sink.h"
#include <mutex>
#include "../details/null_mutex.h"
#include "../details/flush_helper.h"
...
...
include/c11log/sinks/null_sink.h
View file @
32a8b51d
#pragma once
#include <mutex>
#include "base_sink.h"
#include "
./
base_sink.h"
#include "../details/null_mutex.h"
...
...
include/c11log/sinks/ostream_sink.h
View file @
32a8b51d
...
...
@@ -5,7 +5,7 @@
#include <memory>
#include "../details/null_mutex.h"
#include "base_sink.h"
#include "
./
base_sink.h"
namespace
c11log
{
...
...
include/c11log/sinks/stdout_sinks.h
View file @
32a8b51d
...
...
@@ -2,7 +2,7 @@
#include <iostream>
#include <mutex>
#include "ostream_sink.h"
#include "
./
ostream_sink.h"
#include "../details/null_mutex.h"
namespace
c11log
...
...
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