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
a31719b5
Commit
a31719b5
authored
Nov 22, 2018
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clang-format
parent
f97cb007
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
22 additions
and
19 deletions
+22
-19
bench.cpp
bench/bench.cpp
+0
-1
common.h
include/spdlog/common.h
+11
-4
log_msg.h
include/spdlog/details/log_msg.h
+4
-2
logger_impl.h
include/spdlog/details/logger_impl.h
+0
-2
pattern_formatter.h
include/spdlog/details/pattern_formatter.h
+7
-8
logger.h
include/spdlog/logger.h
+0
-0
spdlog.h
include/spdlog/spdlog.h
+0
-1
test_macros.cpp
tests/test_macros.cpp
+0
-1
No files found.
bench/bench.cpp
View file @
a31719b5
...
@@ -67,7 +67,6 @@ int main(int argc, char *argv[])
...
@@ -67,7 +67,6 @@ int main(int argc, char *argv[])
bench
(
howmany
,
spdlog
::
create
<
null_sink_st
>
(
"null_st"
));
bench
(
howmany
,
spdlog
::
create
<
null_sink_st
>
(
"null_st"
));
spdlog
::
info
(
"**************************************************************"
);
spdlog
::
info
(
"**************************************************************"
);
spdlog
::
info
(
"C-string (400 bytes). Single thread, {:n} iterations"
,
howmany
);
spdlog
::
info
(
"C-string (400 bytes). Single thread, {:n} iterations"
,
howmany
);
spdlog
::
info
(
"**************************************************************"
);
spdlog
::
info
(
"**************************************************************"
);
...
...
include/spdlog/common.h
View file @
a31719b5
...
@@ -185,12 +185,19 @@ using filename_t = std::wstring;
...
@@ -185,12 +185,19 @@ using filename_t = std::wstring;
using
filename_t
=
std
::
string
;
using
filename_t
=
std
::
string
;
#endif
#endif
struct
source_loc
struct
source_loc
{
{
SPDLOG_CONSTEXPR
source_loc
()
:
filename
(
""
),
line
(
0
)
{}
SPDLOG_CONSTEXPR
source_loc
()
SPDLOG_CONSTEXPR
source_loc
(
const
char
*
filename
,
int
line
)
:
filename
(
filename
),
line
(
line
)
{}
:
filename
(
""
)
const
char
*
const
filename
;
,
line
(
0
)
{
}
SPDLOG_CONSTEXPR
source_loc
(
const
char
*
filename
,
int
line
)
:
filename
(
filename
)
,
line
(
line
)
{
}
const
char
*
const
filename
;
const
uint32_t
line
;
const
uint32_t
line
;
};
};
...
...
include/spdlog/details/log_msg.h
View file @
a31719b5
...
@@ -31,8 +31,10 @@ struct log_msg
...
@@ -31,8 +31,10 @@ struct log_msg
{
{
}
}
log_msg
(
const
std
::
string
*
loggers_name
,
level
::
level_enum
lvl
,
string_view_t
view
)
:
log_msg
(
const
std
::
string
*
loggers_name
,
level
::
level_enum
lvl
,
string_view_t
view
)
log_msg
(
source_loc
{},
loggers_name
,
lvl
,
view
){}
:
log_msg
(
source_loc
{},
loggers_name
,
lvl
,
view
)
{
}
log_msg
(
const
log_msg
&
other
)
=
default
;
log_msg
(
const
log_msg
&
other
)
=
default
;
log_msg
&
operator
=
(
const
log_msg
&
other
)
=
default
;
log_msg
&
operator
=
(
const
log_msg
&
other
)
=
default
;
...
...
include/spdlog/details/logger_impl.h
View file @
a31719b5
...
@@ -57,7 +57,6 @@ inline void spdlog::logger::set_pattern(std::string pattern, pattern_time_type t
...
@@ -57,7 +57,6 @@ inline void spdlog::logger::set_pattern(std::string pattern, pattern_time_type t
set_formatter
(
std
::
move
(
new_formatter
));
set_formatter
(
std
::
move
(
new_formatter
));
}
}
template
<
typename
...
Args
>
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
log
(
source_loc
source
,
level
::
level_enum
lvl
,
const
char
*
fmt
,
const
Args
&
...
args
)
inline
void
spdlog
::
logger
::
log
(
source_loc
source
,
level
::
level_enum
lvl
,
const
char
*
fmt
,
const
Args
&
...
args
)
{
{
...
@@ -77,7 +76,6 @@ inline void spdlog::logger::log(source_loc source, level::level_enum lvl, const
...
@@ -77,7 +76,6 @@ inline void spdlog::logger::log(source_loc source, level::level_enum lvl, const
SPDLOG_CATCH_AND_HANDLE
SPDLOG_CATCH_AND_HANDLE
}
}
template
<
typename
...
Args
>
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
log
(
level
::
level_enum
lvl
,
const
char
*
fmt
,
const
Args
&
...
args
)
inline
void
spdlog
::
logger
::
log
(
level
::
level_enum
lvl
,
const
char
*
fmt
,
const
Args
&
...
args
)
{
{
...
...
include/spdlog/details/pattern_formatter.h
View file @
a31719b5
...
@@ -815,13 +815,11 @@ public:
...
@@ -815,13 +815,11 @@ public:
explicit
source_location_formatter
(
padding_info
padinfo
)
explicit
source_location_formatter
(
padding_info
padinfo
)
:
flag_formatter
(
padinfo
){};
:
flag_formatter
(
padinfo
){};
void
format
(
const
details
::
log_msg
&
msg
,
const
std
::
tm
&
,
fmt
::
memory_buffer
&
dest
)
override
void
format
(
const
details
::
log_msg
&
msg
,
const
std
::
tm
&
,
fmt
::
memory_buffer
&
dest
)
override
{
{
if
(
padinfo_
.
width_
)
if
(
padinfo_
.
width_
)
{
{
const
auto
text_size
=
std
::
char_traits
<
char
>::
length
(
msg
.
source
.
filename
)
const
auto
text_size
=
std
::
char_traits
<
char
>::
length
(
msg
.
source
.
filename
)
+
fmt_helper
::
count_digits
(
msg
.
source
.
line
)
+
1
;
+
fmt_helper
::
count_digits
(
msg
.
source
.
line
)
+
1
;
scoped_pad
p
(
text_size
,
padinfo_
,
dest
);
scoped_pad
p
(
text_size
,
padinfo_
,
dest
);
fmt_helper
::
append_string_view
(
msg
.
source
.
filename
,
dest
);
fmt_helper
::
append_string_view
(
msg
.
source
.
filename
,
dest
);
dest
.
push_back
(
':'
);
dest
.
push_back
(
':'
);
...
@@ -833,7 +831,7 @@ void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &de
...
@@ -833,7 +831,7 @@ void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &de
dest
.
push_back
(
':'
);
dest
.
push_back
(
':'
);
fmt_helper
::
append_int
(
msg
.
source
.
line
,
dest
);
fmt_helper
::
append_int
(
msg
.
source
.
line
,
dest
);
}
}
}
}
};
};
// print soruce filename
// print soruce filename
class
source_filename_formatter
final
:
public
flag_formatter
class
source_filename_formatter
final
:
public
flag_formatter
...
@@ -858,7 +856,8 @@ public:
...
@@ -858,7 +856,8 @@ public:
void
format
(
const
details
::
log_msg
&
msg
,
const
std
::
tm
&
,
fmt
::
memory_buffer
&
dest
)
override
void
format
(
const
details
::
log_msg
&
msg
,
const
std
::
tm
&
,
fmt
::
memory_buffer
&
dest
)
override
{
{
if
(
padinfo_
.
width_
)
{
if
(
padinfo_
.
width_
)
{
const
size_t
field_size
=
fmt
::
internal
::
count_digits
(
msg
.
source
.
line
);
const
size_t
field_size
=
fmt
::
internal
::
count_digits
(
msg
.
source
.
line
);
scoped_pad
p
(
field_size
,
padinfo_
,
dest
);
scoped_pad
p
(
field_size
,
padinfo_
,
dest
);
fmt_helper
::
append_int
(
msg
.
source
.
line
,
dest
);
fmt_helper
::
append_int
(
msg
.
source
.
line
,
dest
);
...
...
include/spdlog/logger.h
View file @
a31719b5
include/spdlog/spdlog.h
View file @
a31719b5
...
@@ -309,7 +309,6 @@ inline void critical(const wchar_t *fmt, const Args &... args)
...
@@ -309,7 +309,6 @@ inline void critical(const wchar_t *fmt, const Args &... args)
// SPDLOG_LEVEL_OFF
// SPDLOG_LEVEL_OFF
//
//
#define SPDLOG_LOGGER_LOG(logger, level, ...) logger->log(spdlog::source_loc{__FILE__, __LINE__}, level, __VA_ARGS__)
#define SPDLOG_LOGGER_LOG(logger, level, ...) logger->log(spdlog::source_loc{__FILE__, __LINE__}, level, __VA_ARGS__)
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_TRACE
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_TRACE
...
...
tests/test_macros.cpp
View file @
a31719b5
...
@@ -33,7 +33,6 @@ TEST_CASE("debug and trace w/o format string", "[macros]]")
...
@@ -33,7 +33,6 @@ TEST_CASE("debug and trace w/o format string", "[macros]]")
REQUIRE
(
ends_with
(
file_contents
(
filename
),
"Test message 4
\n
"
));
REQUIRE
(
ends_with
(
file_contents
(
filename
),
"Test message 4
\n
"
));
REQUIRE
(
count_lines
(
filename
)
==
2
);
REQUIRE
(
count_lines
(
filename
)
==
2
);
}
}
TEST_CASE
(
"disable param evaluation"
,
"[macros]"
)
TEST_CASE
(
"disable param evaluation"
,
"[macros]"
)
...
...
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