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
08ba1791
Commit
08ba1791
authored
Mar 16, 2014
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
platform eol
parent
9d9a955e
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
8 deletions
+17
-8
example.cpp
example/example.cpp
+3
-2
makefile
example/makefile
+1
-1
line_logger.h
include/c11log/details/line_logger.h
+2
-2
os.h
include/c11log/details/os.h
+11
-3
No files found.
example/example.cpp
View file @
08ba1791
...
@@ -21,6 +21,7 @@ int main(int argc, char* argv[])
...
@@ -21,6 +21,7 @@ int main(int argc, char* argv[])
if
(
argc
||
argv
)
{};
if
(
argc
||
argv
)
{};
auto
fsink
=
std
::
make_shared
<
sinks
::
rotating_file_sink
>
(
"log"
,
"txt"
,
1024
*
1024
*
50
,
5
,
0
);
auto
fsink
=
std
::
make_shared
<
sinks
::
rotating_file_sink
>
(
"log"
,
"txt"
,
1024
*
1024
*
50
,
5
,
0
);
//auto fsink = std::make_shared<sinks::simple_file_sink>("simplelog", "txt");
auto
null_sink
=
std
::
make_shared
<
sinks
::
null_sink
>
();
auto
null_sink
=
std
::
make_shared
<
sinks
::
null_sink
>
();
...
@@ -29,11 +30,11 @@ int main(int argc, char* argv[])
...
@@ -29,11 +30,11 @@ int main(int argc, char* argv[])
cout_logger
.
info
()
<<
"Hello cout logger!"
;
cout_logger
.
info
()
<<
"Hello cout logger!"
;
logger
my_logger
(
"my_logger"
,
{
f
sink
});
logger
my_logger
(
"my_logger"
,
{
null_
sink
});
auto
start
=
system_clock
::
now
();
auto
start
=
system_clock
::
now
();
const
unsigned
int
howmany
=
150
00000
;
const
unsigned
int
howmany
=
5
00000
;
for
(
unsigned
int
i
=
0
;
i
<
howmany
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
howmany
;
i
++
)
my_logger
.
info
()
<<
"Hello logger "
<<
i
;
my_logger
.
info
()
<<
"Hello logger "
<<
i
;
...
...
example/makefile
View file @
08ba1791
CXX
=
g++
CXX
=
g++
CXXFLAGS
=
-march
=
native
-Wall
-Wextra
-Wshadow
-pedantic
-std
=
c++11
-pthread
-I
../include
CXXFLAGS
=
-march
=
native
-Wall
-Wextra
-Wshadow
-pedantic
-std
=
c++11
-pthread
-I
../include
CXX_RELEASE_FLAGS
=
-O3
-flto
CXX_RELEASE_FLAGS
=
-O3
-flto
-g
CXX_DEBUG_FLAGS
=
-g
CXX_DEBUG_FLAGS
=
-g
OUTBIN
=
example
OUTBIN
=
example
...
...
include/c11log/details/line_logger.h
View file @
08ba1791
...
@@ -49,14 +49,14 @@ public:
...
@@ -49,14 +49,14 @@ public:
{
{
if
(
_enabled
)
if
(
_enabled
)
{
{
_oss
<<
'\n'
;
_oss
<<
os
::
eol
()
;
_callback_logger
->
_log_it
(
_oss
.
str_ref
(),
_level
);
_callback_logger
->
_log_it
(
_oss
.
str_ref
(),
_level
);
}
}
}
}
template
<
typename
T
>
template
<
typename
T
>
line_logger
&&
operator
<<
(
const
T
&
msg
)
&&
line_logger
&&
operator
<<
(
const
T
&
msg
)
{
{
if
(
_enabled
)
if
(
_enabled
)
_oss
<<
msg
;
_oss
<<
msg
;
...
...
include/c11log/details/os.h
View file @
08ba1791
...
@@ -14,7 +14,7 @@ inline std::tm localtime(const std::time_t &time_tt)
...
@@ -14,7 +14,7 @@ inline std::tm localtime(const std::time_t &time_tt)
{
{
std
::
tm
tm
;
std
::
tm
tm
;
#ifdef _
MSC_VER
#ifdef _
WIN32
localtime_s
(
&
tm
,
&
time_tt
);
localtime_s
(
&
tm
,
&
time_tt
);
#else
#else
localtime_r
(
&
time_tt
,
&
tm
);
localtime_r
(
&
time_tt
,
&
tm
);
...
@@ -47,9 +47,17 @@ inline bool operator!=(const std::tm& tm1, const std::tm& tm2)
...
@@ -47,9 +47,17 @@ inline bool operator!=(const std::tm& tm1, const std::tm& tm2)
return
!
(
tm1
==
tm2
);
return
!
(
tm1
==
tm2
);
}
}
inline
const
char
*
eol
()
{
#ifdef _WIN32
return
"
\r\n
"
;
#else
return
"
\n
"
;
#endif
}
}
}
}
//os
}
}
//details
}
//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