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
dc137000
Commit
dc137000
authored
Nov 24, 2018
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed source location and make SPDLOG_TRACE: that only one that inject source location info.
parent
1293af09
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
17 deletions
+29
-17
common.h
include/spdlog/common.h
+5
-5
logger_impl.h
include/spdlog/details/logger_impl.h
+2
-2
pattern_formatter.h
include/spdlog/details/pattern_formatter.h
+12
-1
logger.h
include/spdlog/logger.h
+1
-1
spdlog.h
include/spdlog/spdlog.h
+9
-8
No files found.
include/spdlog/common.h
View file @
dc137000
...
...
@@ -197,11 +197,11 @@ struct source_loc
,
line
(
line
)
{
}
//
// source_loc (const source_loc&) = default;
// source_loc& operator=(const source_loc&) = default;
// source_loc& operator=(source_loc&&) = default
;
SPDLOG_CONSTEXPR
bool
empty
()
const
{
return
line
==
0
;
}
const
char
*
filename
;
uint32_t
line
;
};
...
...
include/spdlog/details/logger_impl.h
View file @
dc137000
...
...
@@ -243,7 +243,7 @@ inline void wbuf_to_utf8buf(const fmt::wmemory_buffer &wbuf, fmt::memory_buffer
}
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
log
(
source_loc
ation
source
,
level
::
level_enum
lvl
,
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
inline
void
spdlog
::
logger
::
log
(
source_loc
source
,
level
::
level_enum
lvl
,
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
{
if
(
!
should_log
(
lvl
))
{
...
...
@@ -267,7 +267,7 @@ inline void spdlog::logger::log(source_location source, level::level_enum lvl, c
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
log
(
level
::
level_enum
lvl
,
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
{
log
(
source_loc
ation
{},
lvl
,
fmt
,
args
...);
log
(
source_loc
{},
lvl
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
...
...
include/spdlog/details/pattern_formatter.h
View file @
dc137000
...
...
@@ -817,6 +817,10 @@ public:
void
format
(
const
details
::
log_msg
&
msg
,
const
std
::
tm
&
,
fmt
::
memory_buffer
&
dest
)
override
{
if
(
msg
.
source
.
empty
())
{
return
;
}
if
(
padinfo_
.
width_
)
{
const
auto
text_size
=
std
::
char_traits
<
char
>::
length
(
msg
.
source
.
filename
)
+
fmt_helper
::
count_digits
(
msg
.
source
.
line
)
+
1
;
...
...
@@ -842,6 +846,10 @@ public:
void
format
(
const
details
::
log_msg
&
msg
,
const
std
::
tm
&
,
fmt
::
memory_buffer
&
dest
)
override
{
if
(
msg
.
source
.
empty
())
{
return
;
}
scoped_pad
p
(
msg
.
source
.
filename
,
padinfo_
,
dest
);
fmt_helper
::
append_string_view
(
msg
.
source
.
filename
,
dest
);
}
...
...
@@ -855,7 +863,10 @@ public:
void
format
(
const
details
::
log_msg
&
msg
,
const
std
::
tm
&
,
fmt
::
memory_buffer
&
dest
)
override
{
if
(
msg
.
source
.
empty
())
{
return
;
}
if
(
padinfo_
.
width_
)
{
const
size_t
field_size
=
fmt
::
internal
::
count_digits
(
msg
.
source
.
line
);
...
...
include/spdlog/logger.h
View file @
dc137000
...
...
@@ -79,7 +79,7 @@ public:
void
log
(
level
::
level_enum
lvl
,
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
log
(
source_loc
ation
soruce
,
level
::
level_enum
lvl
,
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
void
log
(
source_loc
soruce
,
level
::
level_enum
lvl
,
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
trace
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
...
...
include/spdlog/spdlog.h
View file @
dc137000
...
...
@@ -309,19 +309,20 @@ inline void critical(const wchar_t *fmt, const Args &... args)
// SPDLOG_LEVEL_OFF
//
#define SPDLOG_LOGGER_LOG(logger, level, ...) logger->log(spdlog::source_loc{__FILE__, __LINE__}, level, __VA_ARGS__)
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_TRACE
#define SPDLOG_LOGGER_TRACE(logger, ...)
SPDLOG_LOGGER_LOG(logger
, spdlog::level::trace, __VA_ARGS__)
#define SPDLOG_TRACE(...) SPDLOG_LOGGER_
LOG(spdlog::default_logger_raw(), spdlog::level::trace
, __VA_ARGS__)
#define SPDLOG_LOGGER_TRACE(logger, ...)
logger->log(spdlog::source_loc{__FILE__, __LINE__}
, spdlog::level::trace, __VA_ARGS__)
#define SPDLOG_TRACE(...) SPDLOG_LOGGER_
TRACE(spdlog::default_logger_raw()
, __VA_ARGS__)
#else
#define SPDLOG_LOGGER_TRACE(logger, ...) (void)0
#define SPDLOG_TRACE(...) (void)0
#endif
#define SPDLOG_LOGGER_LOG(logger, level, ...) logger->log(level, __VA_ARGS__)
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_DEBUG
#define SPDLOG_LOGGER_DEBUG(logger, ...) SPDLOG_LOGGER_LOG(logger, spdlog::level::debug, __VA_ARGS__)
#define SPDLOG_DEBUG(...) SPDLOG_LOGGER_
LOG(spdlog::default_logger_raw(), spdlog::level::debug
, __VA_ARGS__)
#define SPDLOG_DEBUG(...) SPDLOG_LOGGER_
DEBUG(spdlog::default_logger_raw()
, __VA_ARGS__)
#else
#define SPDLOG_LOGGER_DEBUG(logger, ...) (void)0
#define SPDLOG_DEBUG(...) (void)0
...
...
@@ -329,7 +330,7 @@ inline void critical(const wchar_t *fmt, const Args &... args)
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_INFO
#define SPDLOG_LOGGER_INFO(logger, ...) SPDLOG_LOGGER_LOG(logger, spdlog::level::info, __VA_ARGS__)
#define SPDLOG_INFO(...) SPDLOG_LOGGER_
LOG(spdlog::default_logger_raw(), spdlog::level::info
, __VA_ARGS__)
#define SPDLOG_INFO(...) SPDLOG_LOGGER_
INFO(spdlog::default_logger_raw()
, __VA_ARGS__)
#else
#define SPDLOG_LOGGER_INFO(logger, ...) (void)0
#define SPDLOG_INFO(...) (void)0
...
...
@@ -337,7 +338,7 @@ inline void critical(const wchar_t *fmt, const Args &... args)
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_WARN
#define SPDLOG_LOGGER_WARN(logger, ...) SPDLOG_LOGGER_LOG(logger, spdlog::level::warn, __VA_ARGS__)
#define SPDLOG_WARN(...) SPDLOG_
LOGGER_LOG(spdlog::default_logger_raw(), spdlog::level::warn
, __VA_ARGS__)
#define SPDLOG_WARN(...) SPDLOG_
ACTIVE_LEVEL(spdlog::default_logger_raw()
, __VA_ARGS__)
#else
#define SPDLOG_LOGGER_WARN(logger, ...) (void)0
#define SPDLOG_WARN(...) (void)0
...
...
@@ -345,7 +346,7 @@ inline void critical(const wchar_t *fmt, const Args &... args)
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_ERROR
#define SPDLOG_LOGGER_ERROR(logger, ...) SPDLOG_LOGGER_LOG(logger, spdlog::level::err, __VA_ARGS__)
#define SPDLOG_ERROR(...) SPDLOG_LOGGER_
LOG(spdlog::default_logger_raw(), spdlog::level::err
, __VA_ARGS__)
#define SPDLOG_ERROR(...) SPDLOG_LOGGER_
ERROR(spdlog::default_logger_raw()
, __VA_ARGS__)
#else
#define SPDLOG_LOGGER_ERROR(logger, ...) (void)0
#define SPDLOG_ERROR(...) (void)0
...
...
@@ -353,7 +354,7 @@ inline void critical(const wchar_t *fmt, const Args &... args)
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_CRITICAL
#define SPDLOG_LOGGER_CRITICAL(logger, ...) SPDLOG_LOGGER_LOG(logger, spdlog::level::critical, __VA_ARGS__)
#define SPDLOG_CRITICAL(...) SPDLOG_LOGGER_
LOG(spdlog::default_logger_raw(), spdlog::level::critical
, __VA_ARGS__)
#define SPDLOG_CRITICAL(...) SPDLOG_LOGGER_
CRITICAL(spdlog::default_logger_raw()
, __VA_ARGS__)
#else
#define SPDLOG_LOGGER_CRITICAL(logger, ...) (void)0
#define SPDLOG_CRITICAL(...) (void)0
...
...
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