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
1e1ca231
Commit
1e1ca231
authored
Feb 25, 2018
by
Daniel Chabrowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modernize-use-equals-default
parent
e5bbe57f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
44 deletions
+39
-44
include/spdlog/details/file_helper.h
include/spdlog/details/file_helper.h
+2
-1
include/spdlog/details/pattern_formatter_impl.h
include/spdlog/details/pattern_formatter_impl.h
+29
-39
include/spdlog/details/registry.h
include/spdlog/details/registry.h
+2
-1
include/spdlog/sinks/stdout_sinks.h
include/spdlog/sinks/stdout_sinks.h
+6
-3
No files found.
include/spdlog/details/file_helper.h
View file @
1e1ca231
...
@@ -31,7 +31,7 @@ public:
...
@@ -31,7 +31,7 @@ public:
const
int
open_tries
=
5
;
const
int
open_tries
=
5
;
const
int
open_interval
=
10
;
const
int
open_interval
=
10
;
explicit
file_helper
()
{}
explicit
file_helper
()
=
default
;
file_helper
(
const
file_helper
&
)
=
delete
;
file_helper
(
const
file_helper
&
)
=
delete
;
file_helper
&
operator
=
(
const
file_helper
&
)
=
delete
;
file_helper
&
operator
=
(
const
file_helper
&
)
=
delete
;
...
@@ -135,6 +135,7 @@ public:
...
@@ -135,6 +135,7 @@ public:
// finally - return a valid base and extension tuple
// finally - return a valid base and extension tuple
return
std
::
make_tuple
(
fname
.
substr
(
0
,
ext_index
),
fname
.
substr
(
ext_index
));
return
std
::
make_tuple
(
fname
.
substr
(
0
,
ext_index
),
fname
.
substr
(
ext_index
));
}
}
private:
private:
FILE
*
_fd
{
nullptr
};
FILE
*
_fd
{
nullptr
};
filename_t
_filename
;
filename_t
_filename
;
...
...
include/spdlog/details/pattern_formatter_impl.h
View file @
1e1ca231
...
@@ -27,8 +27,7 @@ namespace details
...
@@ -27,8 +27,7 @@ namespace details
class
flag_formatter
class
flag_formatter
{
{
public:
public:
virtual
~
flag_formatter
()
virtual
~
flag_formatter
()
=
default
;
{}
virtual
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
=
0
;
virtual
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
=
0
;
};
};
...
@@ -118,7 +117,6 @@ class B_formatter:public flag_formatter
...
@@ -118,7 +117,6 @@ class B_formatter:public flag_formatter
}
}
};
};
//write 2 ints separated by sep with padding of 2
//write 2 ints separated by sep with padding of 2
static
fmt
::
MemoryWriter
&
pad_n_join
(
fmt
::
MemoryWriter
&
w
,
int
v1
,
int
v2
,
char
sep
)
static
fmt
::
MemoryWriter
&
pad_n_join
(
fmt
::
MemoryWriter
&
w
,
int
v1
,
int
v2
,
char
sep
)
{
{
...
@@ -133,9 +131,8 @@ static fmt::MemoryWriter& pad_n_join(fmt::MemoryWriter& w, int v1, int v2, int v
...
@@ -133,9 +131,8 @@ static fmt::MemoryWriter& pad_n_join(fmt::MemoryWriter& w, int v1, int v2, int v
return
w
;
return
w
;
}
}
//Date and time representation (Thu Aug 23 15:35:46 2014)
//Date and time representation (Thu Aug 23 15:35:46 2014)
class
c_formatter
SPDLOG_FINAL
:
public
flag_formatter
class
c_formatter
SPDLOG_FINAL
:
public
flag_formatter
{
{
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
{
{
...
@@ -144,9 +141,8 @@ class c_formatter SPDLOG_FINAL:public flag_formatter
...
@@ -144,9 +141,8 @@ class c_formatter SPDLOG_FINAL:public flag_formatter
}
}
};
};
// year - 2 digit
// year - 2 digit
class
C_formatter
SPDLOG_FINAL
:
public
flag_formatter
class
C_formatter
SPDLOG_FINAL
:
public
flag_formatter
{
{
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
{
{
...
@@ -154,10 +150,8 @@ class C_formatter SPDLOG_FINAL:public flag_formatter
...
@@ -154,10 +150,8 @@ class C_formatter SPDLOG_FINAL:public flag_formatter
}
}
};
};
// Short MM/DD/YY date, equivalent to %m/%d/%y 08/23/01
// Short MM/DD/YY date, equivalent to %m/%d/%y 08/23/01
class
D_formatter
SPDLOG_FINAL
:
public
flag_formatter
class
D_formatter
SPDLOG_FINAL
:
public
flag_formatter
{
{
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
{
{
...
@@ -165,9 +159,8 @@ class D_formatter SPDLOG_FINAL:public flag_formatter
...
@@ -165,9 +159,8 @@ class D_formatter SPDLOG_FINAL:public flag_formatter
}
}
};
};
// year - 4 digit
// year - 4 digit
class
Y_formatter
SPDLOG_FINAL
:
public
flag_formatter
class
Y_formatter
SPDLOG_FINAL
:
public
flag_formatter
{
{
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
{
{
...
@@ -176,7 +169,7 @@ class Y_formatter SPDLOG_FINAL:public flag_formatter
...
@@ -176,7 +169,7 @@ class Y_formatter SPDLOG_FINAL:public flag_formatter
};
};
// month 1-12
// month 1-12
class
m_formatter
SPDLOG_FINAL
:
public
flag_formatter
class
m_formatter
SPDLOG_FINAL
:
public
flag_formatter
{
{
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
{
{
...
@@ -185,7 +178,7 @@ class m_formatter SPDLOG_FINAL:public flag_formatter
...
@@ -185,7 +178,7 @@ class m_formatter SPDLOG_FINAL:public flag_formatter
};
};
// day of month 1-31
// day of month 1-31
class
d_formatter
SPDLOG_FINAL
:
public
flag_formatter
class
d_formatter
SPDLOG_FINAL
:
public
flag_formatter
{
{
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
{
{
...
@@ -194,7 +187,7 @@ class d_formatter SPDLOG_FINAL:public flag_formatter
...
@@ -194,7 +187,7 @@ class d_formatter SPDLOG_FINAL:public flag_formatter
};
};
// hours in 24 format 0-23
// hours in 24 format 0-23
class
H_formatter
SPDLOG_FINAL
:
public
flag_formatter
class
H_formatter
SPDLOG_FINAL
:
public
flag_formatter
{
{
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
{
{
...
@@ -203,7 +196,7 @@ class H_formatter SPDLOG_FINAL:public flag_formatter
...
@@ -203,7 +196,7 @@ class H_formatter SPDLOG_FINAL:public flag_formatter
};
};
// hours in 12 format 1-12
// hours in 12 format 1-12
class
I_formatter
SPDLOG_FINAL
:
public
flag_formatter
class
I_formatter
SPDLOG_FINAL
:
public
flag_formatter
{
{
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
{
{
...
@@ -212,7 +205,7 @@ class I_formatter SPDLOG_FINAL:public flag_formatter
...
@@ -212,7 +205,7 @@ class I_formatter SPDLOG_FINAL:public flag_formatter
};
};
// minutes 0-59
// minutes 0-59
class
M_formatter
SPDLOG_FINAL
:
public
flag_formatter
class
M_formatter
SPDLOG_FINAL
:
public
flag_formatter
{
{
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
{
{
...
@@ -221,7 +214,7 @@ class M_formatter SPDLOG_FINAL:public flag_formatter
...
@@ -221,7 +214,7 @@ class M_formatter SPDLOG_FINAL:public flag_formatter
};
};
// seconds 0-59
// seconds 0-59
class
S_formatter
SPDLOG_FINAL
:
public
flag_formatter
class
S_formatter
SPDLOG_FINAL
:
public
flag_formatter
{
{
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
{
{
...
@@ -230,7 +223,7 @@ class S_formatter SPDLOG_FINAL:public flag_formatter
...
@@ -230,7 +223,7 @@ class S_formatter SPDLOG_FINAL:public flag_formatter
};
};
// milliseconds
// milliseconds
class
e_formatter
SPDLOG_FINAL
:
public
flag_formatter
class
e_formatter
SPDLOG_FINAL
:
public
flag_formatter
{
{
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
)
override
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
)
override
{
{
...
@@ -241,7 +234,7 @@ class e_formatter SPDLOG_FINAL:public flag_formatter
...
@@ -241,7 +234,7 @@ class e_formatter SPDLOG_FINAL:public flag_formatter
};
};
// microseconds
// microseconds
class
f_formatter
SPDLOG_FINAL
:
public
flag_formatter
class
f_formatter
SPDLOG_FINAL
:
public
flag_formatter
{
{
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
)
override
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
)
override
{
{
...
@@ -252,7 +245,7 @@ class f_formatter SPDLOG_FINAL:public flag_formatter
...
@@ -252,7 +245,7 @@ class f_formatter SPDLOG_FINAL:public flag_formatter
};
};
// nanoseconds
// nanoseconds
class
F_formatter
SPDLOG_FINAL
:
public
flag_formatter
class
F_formatter
SPDLOG_FINAL
:
public
flag_formatter
{
{
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
)
override
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
)
override
{
{
...
@@ -262,7 +255,7 @@ class F_formatter SPDLOG_FINAL:public flag_formatter
...
@@ -262,7 +255,7 @@ class F_formatter SPDLOG_FINAL:public flag_formatter
}
}
};
};
class
E_formatter
SPDLOG_FINAL
:
public
flag_formatter
class
E_formatter
SPDLOG_FINAL
:
public
flag_formatter
{
{
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
)
override
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
)
override
{
{
...
@@ -273,7 +266,7 @@ class E_formatter SPDLOG_FINAL:public flag_formatter
...
@@ -273,7 +266,7 @@ class E_formatter SPDLOG_FINAL:public flag_formatter
};
};
// AM/PM
// AM/PM
class
p_formatter
SPDLOG_FINAL
:
public
flag_formatter
class
p_formatter
SPDLOG_FINAL
:
public
flag_formatter
{
{
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
{
{
...
@@ -281,9 +274,8 @@ class p_formatter SPDLOG_FINAL:public flag_formatter
...
@@ -281,9 +274,8 @@ class p_formatter SPDLOG_FINAL:public flag_formatter
}
}
};
};
// 12 hour clock 02:55:02 pm
// 12 hour clock 02:55:02 pm
class
r_formatter
SPDLOG_FINAL
:
public
flag_formatter
class
r_formatter
SPDLOG_FINAL
:
public
flag_formatter
{
{
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
{
{
...
@@ -292,7 +284,7 @@ class r_formatter SPDLOG_FINAL:public flag_formatter
...
@@ -292,7 +284,7 @@ class r_formatter SPDLOG_FINAL:public flag_formatter
};
};
// 24-hour HH:MM time, equivalent to %H:%M
// 24-hour HH:MM time, equivalent to %H:%M
class
R_formatter
SPDLOG_FINAL
:
public
flag_formatter
class
R_formatter
SPDLOG_FINAL
:
public
flag_formatter
{
{
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
{
{
...
@@ -301,7 +293,7 @@ class R_formatter SPDLOG_FINAL:public flag_formatter
...
@@ -301,7 +293,7 @@ class R_formatter SPDLOG_FINAL:public flag_formatter
};
};
// ISO 8601 time format (HH:MM:SS), equivalent to %H:%M:%S
// ISO 8601 time format (HH:MM:SS), equivalent to %H:%M:%S
class
T_formatter
SPDLOG_FINAL
:
public
flag_formatter
class
T_formatter
SPDLOG_FINAL
:
public
flag_formatter
{
{
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
{
{
...
@@ -315,7 +307,7 @@ class z_formatter SPDLOG_FINAL : public flag_formatter
...
@@ -315,7 +307,7 @@ class z_formatter SPDLOG_FINAL : public flag_formatter
public:
public:
const
std
::
chrono
::
seconds
cache_refresh
=
std
::
chrono
::
seconds
(
5
);
const
std
::
chrono
::
seconds
cache_refresh
=
std
::
chrono
::
seconds
(
5
);
z_formatter
()
{}
z_formatter
()
=
default
;
z_formatter
(
const
z_formatter
&
)
=
delete
;
z_formatter
(
const
z_formatter
&
)
=
delete
;
z_formatter
&
operator
=
(
const
z_formatter
&
)
=
delete
;
z_formatter
&
operator
=
(
const
z_formatter
&
)
=
delete
;
...
@@ -363,10 +355,8 @@ private:
...
@@ -363,10 +355,8 @@ private:
}
}
};
};
// Thread id
// Thread id
class
t_formatter
SPDLOG_FINAL
:
public
flag_formatter
class
t_formatter
SPDLOG_FINAL
:
public
flag_formatter
{
{
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
)
override
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
)
override
{
{
...
@@ -375,7 +365,7 @@ class t_formatter SPDLOG_FINAL:public flag_formatter
...
@@ -375,7 +365,7 @@ class t_formatter SPDLOG_FINAL:public flag_formatter
};
};
// Current pid
// Current pid
class
pid_formatter
SPDLOG_FINAL
:
public
flag_formatter
class
pid_formatter
SPDLOG_FINAL
:
public
flag_formatter
{
{
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
)
override
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
)
override
{
{
...
@@ -384,7 +374,7 @@ class pid_formatter SPDLOG_FINAL:public flag_formatter
...
@@ -384,7 +374,7 @@ class pid_formatter SPDLOG_FINAL:public flag_formatter
};
};
// message counter formatter
// message counter formatter
class
i_formatter
SPDLOG_FINAL
:
public
flag_formatter
class
i_formatter
SPDLOG_FINAL
:
public
flag_formatter
{
{
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
)
override
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
)
override
{
{
...
@@ -392,7 +382,7 @@ class i_formatter SPDLOG_FINAL :public flag_formatter
...
@@ -392,7 +382,7 @@ class i_formatter SPDLOG_FINAL :public flag_formatter
}
}
};
};
class
v_formatter
SPDLOG_FINAL
:
public
flag_formatter
class
v_formatter
SPDLOG_FINAL
:
public
flag_formatter
{
{
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
)
override
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
)
override
{
{
...
@@ -400,7 +390,7 @@ class v_formatter SPDLOG_FINAL:public flag_formatter
...
@@ -400,7 +390,7 @@ class v_formatter SPDLOG_FINAL:public flag_formatter
}
}
};
};
class
ch_formatter
SPDLOG_FINAL
:
public
flag_formatter
class
ch_formatter
SPDLOG_FINAL
:
public
flag_formatter
{
{
public:
public:
explicit
ch_formatter
(
char
ch
)
:
_ch
(
ch
)
explicit
ch_formatter
(
char
ch
)
:
_ch
(
ch
)
...
@@ -415,11 +405,11 @@ private:
...
@@ -415,11 +405,11 @@ private:
//aggregate user chars to display as is
//aggregate user chars to display as is
class
aggregate_formatter
SPDLOG_FINAL
:
public
flag_formatter
class
aggregate_formatter
SPDLOG_FINAL
:
public
flag_formatter
{
{
public:
public:
aggregate_formatter
()
aggregate_formatter
()
=
default
;
{}
void
add_ch
(
char
ch
)
void
add_ch
(
char
ch
)
{
{
_str
+=
ch
;
_str
+=
ch
;
...
@@ -434,7 +424,7 @@ private:
...
@@ -434,7 +424,7 @@ private:
// Full info formatter
// Full info formatter
// pattern: [%Y-%m-%d %H:%M:%S.%e] [%n] [%l] %v
// pattern: [%Y-%m-%d %H:%M:%S.%e] [%n] [%l] %v
class
full_formatter
SPDLOG_FINAL
:
public
flag_formatter
class
full_formatter
SPDLOG_FINAL
:
public
flag_formatter
{
{
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
void
format
(
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
)
override
{
{
...
...
include/spdlog/details/registry.h
View file @
1e1ca231
...
@@ -194,7 +194,7 @@ public:
...
@@ -194,7 +194,7 @@ public:
}
}
private:
private:
registry_t
<
Mutex
>
()
{}
registry_t
<
Mutex
>
()
=
default
;
registry_t
<
Mutex
>
(
const
registry_t
<
Mutex
>&
)
=
delete
;
registry_t
<
Mutex
>
(
const
registry_t
<
Mutex
>&
)
=
delete
;
registry_t
<
Mutex
>&
operator
=
(
const
registry_t
<
Mutex
>&
)
=
delete
;
registry_t
<
Mutex
>&
operator
=
(
const
registry_t
<
Mutex
>&
)
=
delete
;
...
@@ -203,6 +203,7 @@ private:
...
@@ -203,6 +203,7 @@ private:
if
(
_loggers
.
find
(
logger_name
)
!=
_loggers
.
end
())
if
(
_loggers
.
find
(
logger_name
)
!=
_loggers
.
end
())
throw
spdlog_ex
(
"logger with name '"
+
logger_name
+
"' already exists"
);
throw
spdlog_ex
(
"logger with name '"
+
logger_name
+
"' already exists"
);
}
}
Mutex
_mutex
;
Mutex
_mutex
;
std
::
unordered_map
<
std
::
string
,
std
::
shared_ptr
<
logger
>>
_loggers
;
std
::
unordered_map
<
std
::
string
,
std
::
shared_ptr
<
logger
>>
_loggers
;
formatter_ptr
_formatter
;
formatter_ptr
_formatter
;
...
...
include/spdlog/sinks/stdout_sinks.h
View file @
1e1ca231
...
@@ -21,14 +21,16 @@ template <class Mutex>
...
@@ -21,14 +21,16 @@ template <class Mutex>
class
stdout_sink
SPDLOG_FINAL
:
public
base_sink
<
Mutex
>
class
stdout_sink
SPDLOG_FINAL
:
public
base_sink
<
Mutex
>
{
{
using
MyType
=
stdout_sink
<
Mutex
>
;
using
MyType
=
stdout_sink
<
Mutex
>
;
public:
public:
stdout_sink
()
explicit
stdout_sink
()
=
default
;
{}
static
std
::
shared_ptr
<
MyType
>
instance
()
static
std
::
shared_ptr
<
MyType
>
instance
()
{
{
static
std
::
shared_ptr
<
MyType
>
instance
=
std
::
make_shared
<
MyType
>
();
static
std
::
shared_ptr
<
MyType
>
instance
=
std
::
make_shared
<
MyType
>
();
return
instance
;
return
instance
;
}
}
protected:
protected:
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
void
_sink_it
(
const
details
::
log_msg
&
msg
)
override
{
{
...
@@ -49,8 +51,9 @@ template <class Mutex>
...
@@ -49,8 +51,9 @@ template <class Mutex>
class
stderr_sink
SPDLOG_FINAL
:
public
base_sink
<
Mutex
>
class
stderr_sink
SPDLOG_FINAL
:
public
base_sink
<
Mutex
>
{
{
using
MyType
=
stderr_sink
<
Mutex
>
;
using
MyType
=
stderr_sink
<
Mutex
>
;
public:
public:
explicit
stderr_sink
()
{}
explicit
stderr_sink
()
=
default
;
static
std
::
shared_ptr
<
MyType
>
instance
()
static
std
::
shared_ptr
<
MyType
>
instance
()
{
{
...
...
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