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
3a30e57d
Commit
3a30e57d
authored
Jan 27, 2014
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
b10cfa81
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
+8
-8
makefile
build/gcc/makefile
+1
-2
file_sinks.h
include/c11log/sinks/file_sinks.h
+3
-3
test.cpp
src/test.cpp
+4
-3
No files found.
build/gcc/makefile
View file @
3a30e57d
...
@@ -17,7 +17,6 @@ OUTLIB_DEBUG = libc11log-debug.a
...
@@ -17,7 +17,6 @@ OUTLIB_DEBUG = libc11log-debug.a
TEST_RELEASE
=
testme
TEST_RELEASE
=
testme
TEST_DEBUG
=
testme-debug
TEST_DEBUG
=
testme-debug
.PHONY
:
all mkdirs release debug build clean
.PHONY
:
all mkdirs release debug build clean
all
:
release
all
:
release
...
@@ -48,6 +47,6 @@ debug/%.o: $(SRC_DIR)/%.cpp
...
@@ -48,6 +47,6 @@ debug/%.o: $(SRC_DIR)/%.cpp
$(CXX)
-c
$<
-o
$@
$(CXXFLAGS)
$(CXX)
-c
$<
-o
$@
$(CXXFLAGS)
clean
:
clean
:
rm
-rf
release debug
$(TEST_RELEASE)
$(TEST_DEBUG)
$(OUTLIB_RELEASE)
$(OUTLIB_DEBUG)
rm
-rf
release debug
daily.
*
$(TEST_RELEASE)
$(TEST_DEBUG)
$(OUTLIB_RELEASE)
$(OUTLIB_DEBUG)
include/c11log/sinks/file_sinks.h
View file @
3a30e57d
...
@@ -109,15 +109,15 @@ private:
...
@@ -109,15 +109,15 @@ private:
/*
/*
* Thread safe file sink that closes the log file at midnight and opens new one
* Thread safe file sink that closes the log file at midnight and opens new one
*/
*/
class
midnight
_file_sink
:
public
base_sink
{
class
daily
_file_sink
:
public
base_sink
{
public
:
public
:
midnight
_file_sink
(
const
std
::
string
&
base_filename
,
const
std
::
string
&
extension
=
"txt"
)
:
daily
_file_sink
(
const
std
::
string
&
base_filename
,
const
std
::
string
&
extension
=
"txt"
)
:
_base_filename
(
base_filename
),
_base_filename
(
base_filename
),
_extension
(
extension
),
_extension
(
extension
),
_midnight_tp
{
_calc_midnight_tp
()
}
_midnight_tp
{
_calc_midnight_tp
()
}
{
{
_ofstream
.
open
(
_calc_filename
(
_base_filename
,
_extension
));
_ofstream
.
open
(
_calc_filename
(
_base_filename
,
_extension
)
,
std
::
ofstream
::
app
);
}
}
protected
:
protected
:
...
...
src/test.cpp
View file @
3a30e57d
...
@@ -16,9 +16,9 @@ int main(int argc, char* argv[])
...
@@ -16,9 +16,9 @@ int main(int argc, char* argv[])
int
nthreads
=
argc
>
1
?
atoi
(
argv
[
1
])
:
1
;
int
nthreads
=
argc
>
1
?
atoi
(
argv
[
1
])
:
1
;
auto
null_sink
=
std
::
make_shared
<
c11log
::
sinks
::
null_sink
>
();
auto
null_sink
=
std
::
make_shared
<
c11log
::
sinks
::
null_sink
>
();
auto
stdout_sink
=
std
::
make_shared
<
c11log
::
sinks
::
stdout_sink
>
();
auto
stdout_sink
=
std
::
make_shared
<
c11log
::
sinks
::
stdout_sink
>
();
auto
async
=
std
::
make_shared
<
c11log
::
sinks
::
async_sink
>
(
100
);
auto
async
=
std
::
make_shared
<
c11log
::
sinks
::
async_sink
>
(
100
0
);
//auto fsink = std::make_shared<c11log::sinks::rotating_file_sink>("newlog", "txt", 1024*1024*10 , 2);
//auto fsink = std::make_shared<c11log::sinks::rotating_file_sink>("newlog", "txt", 1024*1024*10 , 2);
auto
fsink
=
std
::
make_shared
<
c11log
::
sinks
::
midnight_file_sink
>
(
"midnight
"
,
"txt"
);
auto
fsink
=
std
::
make_shared
<
c11log
::
sinks
::
daily_file_sink
>
(
"daily
"
,
"txt"
);
async
->
add_sink
(
fsink
);
async
->
add_sink
(
fsink
);
...
@@ -39,7 +39,8 @@ int main(int argc, char* argv[])
...
@@ -39,7 +39,8 @@ int main(int argc, char* argv[])
});
});
}
}
while
(
true
)
int
seconds
=
0
;
while
(
seconds
++
<
5
)
{
{
counter
=
0
;
counter
=
0
;
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
seconds
(
1
));
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
seconds
(
1
));
...
...
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