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
45628c8e
Commit
45628c8e
authored
Dec 01, 2014
by
gabi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
logger main interface now is in the form logger.info(fmt, args)
parent
eaa61ed4
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
347 additions
and
624 deletions
+347
-624
include/spdlog/details/format.cc
include/spdlog/details/format.cc
+10
-4
include/spdlog/details/format.h
include/spdlog/details/format.h
+297
-562
include/spdlog/details/line_logger.h
include/spdlog/details/line_logger.h
+7
-0
include/spdlog/details/logger_impl.h
include/spdlog/details/logger_impl.h
+22
-39
include/spdlog/logger.h
include/spdlog/logger.h
+11
-19
No files found.
include/spdlog/details/format.cc
View file @
45628c8e
...
...
@@ -400,7 +400,8 @@ int fmt::internal::CharTraits<wchar_t>::format_float(
swprintf
(
buffer
,
size
,
format
,
width
,
precision
,
value
);
}
const
char
fmt
::
internal
::
DIGITS
[]
=
template
<
typename
T
>
const
char
fmt
::
internal
::
BasicData
<
T
>::
DIGITS
[]
=
"0001020304050607080910111213141516171819"
"2021222324252627282930313233343536373839"
"4041424344454647484950515253545556575859"
...
...
@@ -418,8 +419,13 @@ const char fmt::internal::DIGITS[] =
factor * 100000000, \
factor * 1000000000
const
uint32_t
fmt
::
internal
::
POWERS_OF_10_32
[]
=
{
0
,
FMT_POWERS_OF_10
(
1
)
};
const
uint64_t
fmt
::
internal
::
POWERS_OF_10_64
[]
=
{
template
<
typename
T
>
const
uint32_t
fmt
::
internal
::
BasicData
<
T
>::
POWERS_OF_10_32
[]
=
{
0
,
FMT_POWERS_OF_10
(
1
)
};
template
<
typename
T
>
const
uint64_t
fmt
::
internal
::
BasicData
<
T
>::
POWERS_OF_10_64
[]
=
{
0
,
FMT_POWERS_OF_10
(
1
),
FMT_POWERS_OF_10
(
ULongLong
(
1000000000
)),
...
...
@@ -1163,4 +1169,4 @@ template int fmt::internal::CharTraits<wchar_t>::format_float(
#if _MSC_VER
# pragma warning(pop)
#endif
#endif
\ No newline at end of file
include/spdlog/details/format.h
View file @
45628c8e
This diff is collapsed.
Click to expand it.
include/spdlog/details/line_logger.h
View file @
45628c8e
...
...
@@ -79,6 +79,12 @@ public:
}
}
template
<
typename
...
Args
>
void
write
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
)
{
_log_msg
.
raw
.
write
(
fmt
,
args
...);
}
template
<
typename
T
>
line_logger
&
operator
<<
(
const
T
&
what
)
{
...
...
@@ -86,6 +92,7 @@ public:
return
*
this
;
}
void
disable
()
{
_enabled
=
false
;
...
...
include/spdlog/details/logger_impl.h
View file @
45628c8e
...
...
@@ -66,73 +66,73 @@ inline void spdlog::logger::set_pattern(const std::string& pattern)
template
<
typename
...
Args
>
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
log
(
level
::
level_enum
lvl
,
const
Args
&
...
args
)
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
log
(
level
::
level_enum
lvl
,
const
std
::
string
&
fmt
,
const
Args
&
...
args
)
{
bool
msg_enabled
=
should_log
(
lvl
);
details
::
line_logger
l
(
this
,
lvl
,
msg_enabled
);
if
(
msg_enabled
)
_variadic_log
(
l
,
args
...);
l
.
write
(
fmt
,
args
...);
return
l
;
}
template
<
typename
...
Args
>
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
log
(
const
Args
&
...
args
)
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
log
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
)
{
return
log
(
level
::
ALWAYS
,
args
...);
return
log
(
level
::
ALWAYS
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
trace
(
const
Args
&
...
args
)
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
trace
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
)
{
return
log
(
level
::
TRACE
,
args
...);
return
log
(
level
::
TRACE
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
debug
(
const
Args
&
...
args
)
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
debug
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
)
{
return
log
(
level
::
DEBUG
,
args
...);
return
log
(
level
::
DEBUG
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
info
(
const
Args
&
...
args
)
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
info
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
)
{
return
log
(
level
::
INFO
,
args
...);
return
log
(
level
::
INFO
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
notice
(
const
Args
&
...
args
)
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
notice
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
)
{
return
log
(
level
::
NOTICE
,
args
...);
return
log
(
level
::
NOTICE
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
warn
(
const
Args
&
...
args
)
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
warn
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
)
{
return
log
(
level
::
WARN
,
args
...);
return
log
(
level
::
WARN
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
error
(
const
Args
&
...
args
)
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
error
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
)
{
return
log
(
level
::
ERR
,
args
...);
return
log
(
level
::
ERR
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
critical
(
const
Args
&
...
args
)
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
critical
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
)
{
return
log
(
level
::
CRITICAL
,
args
...);
return
log
(
level
::
CRITICAL
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
alert
(
const
Args
&
...
args
)
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
alert
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
)
{
return
log
(
level
::
ALERT
,
args
...);
return
log
(
level
::
ALERT
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
emerg
(
const
Args
&
...
args
)
inline
spdlog
::
details
::
line_logger
spdlog
::
logger
::
emerg
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
)
{
return
log
(
level
::
EMERG
,
args
...);
return
log
(
level
::
EMERG
,
fmt
,
args
...);
}
inline
const
std
::
string
&
spdlog
::
logger
::
name
()
const
...
...
@@ -182,24 +182,7 @@ inline void spdlog::logger::_stop()
set_level
(
level
::
OFF
);
}
/* private functions */
inline
void
spdlog
::
logger
::
_variadic_log
(
spdlog
::
details
::
line_logger
&
)
{}
template
<
typename
Last
>
inline
void
spdlog
::
logger
::
_variadic_log
(
spdlog
::
details
::
line_logger
&
l
,
const
Last
&
last
)
{
l
.
write
(
last
);
}
template
<
typename
First
,
typename
...
Rest
>
inline
void
spdlog
::
logger
::
_variadic_log
(
spdlog
::
details
::
line_logger
&
l
,
const
First
&
first
,
const
Rest
&
...
rest
)
{
l
.
write
(
first
);
l
.
write
(
' '
);
_variadic_log
(
l
,
rest
...);
}
include/spdlog/logger.h
View file @
45628c8e
...
...
@@ -34,7 +34,6 @@
#include<vector>
#include<memory>
#include "sinks/base_sink.h"
#include "sinks/async_sink.h"
#include "common.h"
namespace
spdlog
...
...
@@ -66,17 +65,17 @@ public:
//Stop logging
void
stop
();
template
<
typename
...
Args
>
details
::
line_logger
log
(
level
::
level_enum
lvl
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
log
(
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
trace
(
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
debug
(
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
info
(
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
notice
(
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
warn
(
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
error
(
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
critical
(
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
alert
(
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
emerg
(
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
log
(
level
::
level_enum
lvl
,
const
std
::
string
&
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
log
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
trace
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
debug
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
info
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
notice
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
warn
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
error
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
critical
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
alert
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
details
::
line_logger
emerg
(
const
std
::
string
&
fmt
,
const
Args
&
...
args
);
void
set_pattern
(
const
std
::
string
&
);
...
...
@@ -96,13 +95,6 @@ protected:
formatter_ptr
_formatter
;
std
::
atomic_int
_level
;
private:
void
_variadic_log
(
details
::
line_logger
&
l
);
template
<
typename
Last
>
inline
void
_variadic_log
(
spdlog
::
details
::
line_logger
&
l
,
const
Last
&
last
);
template
<
typename
First
,
typename
...
Rest
>
void
_variadic_log
(
details
::
line_logger
&
l
,
const
First
&
first
,
const
Rest
&
...
rest
);
};
}
...
...
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