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
fb6df051
Commit
fb6df051
authored
Feb 24, 2018
by
Daniel Chabrowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modernize-use-override
parent
7f4c1bb7
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
38 additions
and
42 deletions
+38
-42
async_logger.h
include/spdlog/async_logger.h
+3
-3
common.h
include/spdlog/common.h
+2
-2
formatter.h
include/spdlog/formatter.h
+2
-3
ansicolor_sink.h
include/spdlog/sinks/ansicolor_sink.h
+5
-3
base_sink.h
include/spdlog/sinks/base_sink.h
+2
-2
dist_sink.h
include/spdlog/sinks/dist_sink.h
+1
-4
file_sinks.h
include/spdlog/sinks/file_sinks.h
+4
-2
msvc_sink.h
include/spdlog/sinks/msvc_sink.h
+1
-3
null_sink.h
include/spdlog/sinks/null_sink.h
+1
-1
ostream_sink.h
include/spdlog/sinks/ostream_sink.h
+1
-2
sink.h
include/spdlog/sinks/sink.h
+1
-4
stdout_sinks.h
include/spdlog/sinks/stdout_sinks.h
+3
-2
syslog_sink.h
include/spdlog/sinks/syslog_sink.h
+2
-1
wincolor_sink.h
include/spdlog/sinks/wincolor_sink.h
+9
-9
windebug_sink.h
include/spdlog/sinks/windebug_sink.h
+1
-1
No files found.
include/spdlog/async_logger.h
View file @
fb6df051
...
...
@@ -31,7 +31,7 @@ namespace details
class
async_log_helper
;
}
class
async_logger
SPDLOG_FINAL
:
public
logger
class
async_logger
SPDLOG_FINAL
:
public
logger
{
public
:
template
<
class
It
>
...
...
@@ -65,8 +65,8 @@ public:
void
flush
()
override
;
// Error handler
v
irtual
v
oid
set_error_handler
(
log_err_handler
)
override
;
virtual
log_err_handler
error_handler
()
override
;
void
set_error_handler
(
log_err_handler
)
override
;
log_err_handler
error_handler
()
override
;
protected
:
void
_sink_it
(
details
::
log_msg
&
msg
)
override
;
...
...
include/spdlog/common.h
View file @
fb6df051
...
...
@@ -136,7 +136,7 @@ namespace os
std
::
string
errno_str
(
int
err_num
);
}
}
class
spdlog_ex
:
public
std
::
exception
class
spdlog_ex
:
public
std
::
exception
{
public
:
spdlog_ex
(
const
std
::
string
&
msg
)
:
_msg
(
msg
)
...
...
@@ -149,9 +149,9 @@ public:
{
return
_msg
.
c_str
();
}
private
:
std
::
string
_msg
;
};
//
...
...
include/spdlog/formatter.h
View file @
fb6df051
...
...
@@ -21,18 +21,18 @@ class flag_formatter;
class
formatter
{
public
:
virtual
~
formatter
()
{}
virtual
~
formatter
()
=
default
;
virtual
void
format
(
details
::
log_msg
&
msg
)
=
0
;
};
class
pattern_formatter
SPDLOG_FINAL
:
public
formatter
{
public
:
explicit
pattern_formatter
(
const
std
::
string
&
pattern
,
pattern_time_type
pattern_time
=
pattern_time_type
::
local
,
const
std
::
string
&
eol
=
spdlog
::
details
::
os
::
default_eol
);
pattern_formatter
(
const
pattern_formatter
&
)
=
delete
;
pattern_formatter
&
operator
=
(
const
pattern_formatter
&
)
=
delete
;
void
format
(
details
::
log_msg
&
msg
)
override
;
private
:
const
std
::
string
_eol
;
const
std
::
string
_pattern
;
...
...
@@ -45,4 +45,3 @@ private:
}
#include "details/pattern_formatter_impl.h"
include/spdlog/sinks/ansicolor_sink.h
View file @
fb6df051
...
...
@@ -23,7 +23,7 @@ namespace sinks
* If no color terminal detected, omit the escape codes.
*/
template
<
class
Mutex
>
class
ansicolor_sink
:
public
base_sink
<
Mutex
>
class
ansicolor_sink
:
public
base_sink
<
Mutex
>
{
public
:
ansicolor_sink
(
FILE
*
file
)
:
target_file_
(
file
)
...
...
@@ -37,7 +37,8 @@ public:
colors_
[
level
::
critical
]
=
bold
+
on_red
;
colors_
[
level
::
off
]
=
reset
;
}
virtual
~
ansicolor_sink
()
~
ansicolor_sink
()
override
{
_flush
();
}
...
...
@@ -79,7 +80,7 @@ public:
const
std
::
string
on_white
=
"
\033
[47m"
;
protected
:
v
irtual
v
oid
_sink_it
(
const
details
::
log_msg
&
msg
)
override
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
{
// Wrap the originally formatted message in color codes.
// If color is not supported in the terminal, log as is instead.
...
...
@@ -102,6 +103,7 @@ protected:
{
fflush
(
target_file_
);
}
FILE
*
target_file_
;
bool
should_do_colors_
;
std
::
unordered_map
<
level
::
level_enum
,
std
::
string
,
level
::
level_hasher
>
colors_
;
...
...
include/spdlog/sinks/base_sink.h
View file @
fb6df051
...
...
@@ -22,11 +22,10 @@ namespace spdlog
namespace
sinks
{
template
<
class
Mutex
>
class
base_sink
:
public
sink
class
base_sink
:
public
sink
{
public
:
base_sink
()
:
_mutex
()
{}
virtual
~
base_sink
()
=
default
;
base_sink
(
const
base_sink
&
)
=
delete
;
base_sink
&
operator
=
(
const
base_sink
&
)
=
delete
;
...
...
@@ -36,6 +35,7 @@ public:
std
::
lock_guard
<
Mutex
>
lock
(
_mutex
);
_sink_it
(
msg
);
}
void
flush
()
SPDLOG_FINAL
override
{
std
::
lock_guard
<
Mutex
>
lock
(
_mutex
);
...
...
include/spdlog/sinks/dist_sink.h
View file @
fb6df051
...
...
@@ -22,13 +22,12 @@ namespace spdlog
namespace
sinks
{
template
<
class
Mutex
>
class
dist_sink
:
public
base_sink
<
Mutex
>
class
dist_sink
:
public
base_sink
<
Mutex
>
{
public
:
explicit
dist_sink
()
:
_sinks
()
{}
dist_sink
(
const
dist_sink
&
)
=
delete
;
dist_sink
&
operator
=
(
const
dist_sink
&
)
=
delete
;
virtual
~
dist_sink
()
=
default
;
protected
:
std
::
vector
<
std
::
shared_ptr
<
sink
>>
_sinks
;
...
...
@@ -51,8 +50,6 @@ protected:
}
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 @
fb6df051
...
...
@@ -26,7 +26,7 @@ namespace sinks
* Trivial file sink with single file as target
*/
template
<
class
Mutex
>
class
simple_file_sink
SPDLOG_FINAL
:
public
base_sink
<
Mutex
>
class
simple_file_sink
SPDLOG_FINAL
:
public
base_sink
<
Mutex
>
{
public
:
explicit
simple_file_sink
(
const
filename_t
&
filename
,
bool
truncate
=
false
)
:
_force_flush
(
false
)
...
...
@@ -46,10 +46,12 @@ protected:
if
(
_force_flush
)
_file_helper
.
flush
();
}
void
_flush
()
override
{
_file_helper
.
flush
();
}
private
:
details
::
file_helper
_file_helper
;
bool
_force_flush
;
...
...
@@ -112,7 +114,6 @@ protected:
_file_helper
.
flush
();
}
private
:
// Rotate files:
// log.txt -> log.1.txt
...
...
@@ -142,6 +143,7 @@ private:
}
_file_helper
.
reopen
(
true
);
}
filename_t
_base_filename
;
std
::
size_t
_max_size
;
std
::
size_t
_max_files
;
...
...
include/spdlog/sinks/msvc_sink.h
View file @
fb6df051
...
...
@@ -23,15 +23,13 @@ namespace sinks
* MSVC sink (logging using OutputDebugStringA)
*/
template
<
class
Mutex
>
class
msvc_sink
:
public
base_sink
<
Mutex
>
class
msvc_sink
:
public
base_sink
<
Mutex
>
{
public
:
explicit
msvc_sink
()
{
}
protected
:
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
{
...
...
include/spdlog/sinks/null_sink.h
View file @
fb6df051
...
...
@@ -16,7 +16,7 @@ namespace sinks
{
template
<
class
Mutex
>
class
null_sink
:
public
base_sink
<
Mutex
>
class
null_sink
:
public
base_sink
<
Mutex
>
{
protected
:
void
_sink_it
(
const
details
::
log_msg
&
)
override
...
...
include/spdlog/sinks/ostream_sink.h
View file @
fb6df051
...
...
@@ -16,13 +16,12 @@ namespace spdlog
namespace
sinks
{
template
<
class
Mutex
>
class
ostream_sink
:
public
base_sink
<
Mutex
>
class
ostream_sink
:
public
base_sink
<
Mutex
>
{
public
:
explicit
ostream_sink
(
std
::
ostream
&
os
,
bool
force_flush
=
false
)
:
_ostream
(
os
),
_force_flush
(
force_flush
)
{}
ostream_sink
(
const
ostream_sink
&
)
=
delete
;
ostream_sink
&
operator
=
(
const
ostream_sink
&
)
=
delete
;
virtual
~
ostream_sink
()
=
default
;
protected
:
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
...
...
include/spdlog/sinks/sink.h
View file @
fb6df051
...
...
@@ -3,7 +3,6 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
//
#pragma once
#include "../details/log_msg.h"
...
...
@@ -20,7 +19,7 @@ public:
_level
=
level
::
trace
;
}
virtual
~
sink
()
{}
virtual
~
sink
()
=
default
;
virtual
void
log
(
const
details
::
log_msg
&
msg
)
=
0
;
virtual
void
flush
()
=
0
;
...
...
@@ -30,7 +29,6 @@ public:
private
:
level_t
_level
;
};
inline
bool
sink
::
should_log
(
level
::
level_enum
msg_level
)
const
...
...
@@ -50,4 +48,3 @@ inline level::level_enum sink::level() const
}
}
include/spdlog/sinks/stdout_sinks.h
View file @
fb6df051
...
...
@@ -50,13 +50,14 @@ class stderr_sink SPDLOG_FINAL : public base_sink<Mutex>
{
using
MyType
=
stderr_sink
<
Mutex
>
;
public
:
stderr_sink
()
{}
explicit
stderr_sink
()
{}
static
std
::
shared_ptr
<
MyType
>
instance
()
{
static
std
::
shared_ptr
<
MyType
>
instance
=
std
::
make_shared
<
MyType
>
();
return
instance
;
}
protected
:
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
{
...
...
include/spdlog/sinks/syslog_sink.h
View file @
fb6df051
...
...
@@ -44,7 +44,8 @@ public:
//set ident to be program name if empty
::
openlog
(
_ident
.
empty
()
?
nullptr
:
_ident
.
c_str
(),
syslog_option
,
syslog_facility
);
}
~
syslog_sink
()
~
syslog_sink
()
override
{
::
closelog
();
}
...
...
include/spdlog/sinks/wincolor_sink.h
View file @
fb6df051
...
...
@@ -21,8 +21,8 @@ namespace sinks
/*
* Windows color console sink. Uses WriteConsoleA to write to the console with colors
*/
template
<
class
Mutex
>
class
wincolor_sink
:
public
base_sink
<
Mutex
>
template
<
class
Mutex
>
class
wincolor_sink
:
public
base_sink
<
Mutex
>
{
public
:
const
WORD
BOLD
=
FOREGROUND_INTENSITY
;
...
...
@@ -42,7 +42,7 @@ public:
colors_
[
level
::
off
]
=
0
;
}
virtual
~
wincolor_sink
()
~
wincolor_sink
()
override
{
this
->
flush
();
}
...
...
@@ -58,7 +58,7 @@ public:
}
protected
:
v
irtual
v
oid
_sink_it
(
const
details
::
log_msg
&
msg
)
override
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
{
auto
color
=
colors_
[
msg
.
level
];
auto
orig_attribs
=
set_console_attribs
(
color
);
...
...
@@ -66,7 +66,7 @@ protected:
SetConsoleTextAttribute
(
out_handle_
,
orig_attribs
);
//reset to orig colors
}
v
irtual
v
oid
_flush
()
override
void
_flush
()
override
{
// windows console always flushed?
}
...
...
@@ -92,8 +92,8 @@ private:
//
// windows color console to stdout
//
template
<
class
Mutex
>
class
wincolor_stdout_sink
:
public
wincolor_sink
<
Mutex
>
template
<
class
Mutex
>
class
wincolor_stdout_sink
:
public
wincolor_sink
<
Mutex
>
{
public
:
wincolor_stdout_sink
()
:
wincolor_sink
<
Mutex
>
(
GetStdHandle
(
STD_OUTPUT_HANDLE
))
...
...
@@ -106,8 +106,8 @@ using wincolor_stdout_sink_st = wincolor_stdout_sink<details::null_mutex>;
//
// windows color console to stderr
//
template
<
class
Mutex
>
class
wincolor_stderr_sink
:
public
wincolor_sink
<
Mutex
>
template
<
class
Mutex
>
class
wincolor_stderr_sink
:
public
wincolor_sink
<
Mutex
>
{
public
:
wincolor_stderr_sink
()
:
wincolor_sink
<
Mutex
>
(
GetStdHandle
(
STD_ERROR_HANDLE
))
...
...
include/spdlog/sinks/windebug_sink.h
View file @
fb6df051
...
...
@@ -17,7 +17,7 @@ namespace sinks
/*
* Windows debug sink (logging using OutputDebugStringA, synonym for msvc_sink)
*/
template
<
class
Mutex
>
template
<
class
Mutex
>
using
windebug_sink
=
msvc_sink
<
Mutex
>
;
using
windebug_sink_mt
=
msvc_sink_mt
;
...
...
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