Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
spdlog
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
spdlog
Commits
095cb1f5
Commit
095cb1f5
authored
May 21, 2017
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added _flush() to base_sink
parent
e215758b
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
46 additions
and
32 deletions
+46
-32
include/spdlog/sinks/ansicolor_sink.h
include/spdlog/sinks/ansicolor_sink.h
+6
-4
include/spdlog/sinks/base_sink.h
include/spdlog/sinks/base_sink.h
+5
-0
include/spdlog/sinks/dist_sink.h
include/spdlog/sinks/dist_sink.h
+8
-6
include/spdlog/sinks/file_sinks.h
include/spdlog/sinks/file_sinks.h
+16
-13
include/spdlog/sinks/msvc_sink.h
include/spdlog/sinks/msvc_sink.h
+4
-3
include/spdlog/sinks/null_sink.h
include/spdlog/sinks/null_sink.h
+1
-1
include/spdlog/sinks/stdout_sinks.h
include/spdlog/sinks/stdout_sinks.h
+4
-4
include/spdlog/sinks/wincolor_sink.h
include/spdlog/sinks/wincolor_sink.h
+2
-1
No files found.
include/spdlog/sinks/ansicolor_sink.h
View file @
095cb1f5
...
...
@@ -42,10 +42,7 @@ public:
flush
();
}
void
flush
()
override
{
fflush
(
target_file_
);
}
protected:
virtual
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
...
...
@@ -66,6 +63,11 @@ protected:
}
flush
();
}
void
_flush
()
override
{
fflush
(
target_file_
);
}
FILE
*
target_file_
;
bool
should_do_colors_
;
std
::
map
<
level
::
level_enum
,
std
::
string
>
colors_
;
...
...
include/spdlog/sinks/base_sink.h
View file @
095cb1f5
...
...
@@ -36,9 +36,14 @@ public:
std
::
lock_guard
<
Mutex
>
lock
(
_mutex
);
_sink_it
(
msg
);
}
void
flush
()
SPDLOG_FINAL
override
{
_flush
();
}
protected:
virtual
void
_sink_it
(
const
details
::
log_msg
&
msg
)
=
0
;
virtual
void
_flush
()
=
0
;
Mutex
_mutex
;
};
}
...
...
include/spdlog/sinks/dist_sink.h
View file @
095cb1f5
...
...
@@ -44,14 +44,16 @@ protected:
}
}
public:
void
flush
()
override
void
_flush
()
override
{
std
::
lock_guard
<
Mutex
>
lock
(
base_sink
<
Mutex
>::
_mutex
);
for
(
auto
&
sink
:
_sinks
)
sink
->
flush
();
}
public:
void
add_sink
(
std
::
shared_ptr
<
sink
>
sink
)
{
std
::
lock_guard
<
Mutex
>
lock
(
base_sink
<
Mutex
>::
_mutex
);
...
...
include/spdlog/sinks/file_sinks.h
View file @
095cb1f5
...
...
@@ -33,10 +33,7 @@ public:
{
_file_helper
.
open
(
filename
,
truncate
);
}
void
flush
()
override
{
_file_helper
.
flush
();
}
void
set_force_flush
(
bool
force_flush
)
{
_force_flush
=
force_flush
;
...
...
@@ -49,6 +46,10 @@ protected:
if
(
_force_flush
)
_file_helper
.
flush
();
}
void
_flush
()
override
{
_file_helper
.
flush
();
}
private:
details
::
file_helper
_file_helper
;
bool
_force_flush
;
...
...
@@ -76,10 +77,6 @@ public:
_current_size
=
_file_helper
.
size
();
//expensive. called only once
}
void
flush
()
override
{
_file_helper
.
flush
();
}
protected:
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
...
...
@@ -93,6 +90,11 @@ protected:
_file_helper
.
write
(
msg
);
}
void
_flush
()
override
{
_file_helper
.
flush
();
}
private:
static
filename_t
calc_filename
(
const
filename_t
&
filename
,
std
::
size_t
index
)
{
...
...
@@ -194,10 +196,6 @@ public:
_file_helper
.
open
(
FileNameCalc
::
calc_filename
(
_base_filename
));
}
void
flush
()
override
{
_file_helper
.
flush
();
}
protected:
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
...
...
@@ -210,6 +208,11 @@ protected:
_file_helper
.
write
(
msg
);
}
void
_flush
()
override
{
_file_helper
.
flush
();
}
private:
std
::
chrono
::
system_clock
::
time_point
_next_rotation_tp
()
{
...
...
include/spdlog/sinks/msvc_sink.h
View file @
095cb1f5
...
...
@@ -30,15 +30,16 @@ public:
{
}
void
flush
()
override
{
}
protected:
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
{
OutputDebugStringA
(
msg
.
formatted
.
c_str
());
}
void
_flush
()
override
{}
};
typedef
msvc_sink
<
std
::
mutex
>
msvc_sink_mt
;
...
...
include/spdlog/sinks/null_sink.h
View file @
095cb1f5
...
...
@@ -22,7 +22,7 @@ protected:
void
_sink_it
(
const
details
::
log_msg
&
)
override
{}
void
flush
()
override
void
_
flush
()
override
{}
};
...
...
include/spdlog/sinks/stdout_sinks.h
View file @
095cb1f5
...
...
@@ -29,14 +29,14 @@ public:
static
std
::
shared_ptr
<
MyType
>
instance
=
std
::
make_shared
<
MyType
>
();
return
instance
;
}
protected:
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
{
fwrite
(
msg
.
formatted
.
data
(),
sizeof
(
char
),
msg
.
formatted
.
size
(),
stdout
);
flush
();
}
void
flush
()
override
void
_
flush
()
override
{
fflush
(
stdout
);
}
...
...
@@ -58,14 +58,14 @@ public:
static
std
::
shared_ptr
<
MyType
>
instance
=
std
::
make_shared
<
MyType
>
();
return
instance
;
}
protected:
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
{
fwrite
(
msg
.
formatted
.
data
(),
sizeof
(
char
),
msg
.
formatted
.
size
(),
stderr
);
flush
();
}
void
flush
()
override
void
_
flush
()
override
{
fflush
(
stderr
);
}
...
...
include/spdlog/sinks/wincolor_sink.h
View file @
095cb1f5
...
...
@@ -50,6 +50,7 @@ public:
wincolor_sink
(
const
wincolor_sink
&
other
)
=
delete
;
wincolor_sink
&
operator
=
(
const
wincolor_sink
&
other
)
=
delete
;
protected:
virtual
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
{
auto
color
=
colors_
[
msg
.
level
];
...
...
@@ -58,7 +59,7 @@ public:
SetConsoleTextAttribute
(
out_handle_
,
orig_attribs
);
//reset to orig colors
}
virtual
void
flush
()
override
virtual
void
_
flush
()
override
{
// windows console always flushed?
}
...
...
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