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
d817994b
Commit
d817994b
authored
Dec 09, 2014
by
gabi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved namespace fmt to be under spdlog::details to minimize namespace pollution for the users
parent
5cf9437a
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
125 additions
and
115 deletions
+125
-115
include/spdlog/details/format.cc
include/spdlog/details/format.cc
+109
-106
include/spdlog/details/format.h
include/spdlog/details/format.h
+11
-4
include/spdlog/details/pattern_formatter_impl.h
include/spdlog/details/pattern_formatter_impl.h
+3
-3
include/spdlog/sinks/file_sinks.h
include/spdlog/sinks/file_sinks.h
+2
-2
No files found.
include/spdlog/details/format.cc
View file @
d817994b
This diff is collapsed.
Click to expand it.
include/spdlog/details/format.h
View file @
d817994b
...
@@ -115,7 +115,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
...
@@ -115,7 +115,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define FMT_DISALLOW_COPY_AND_ASSIGN(TypeName) \
#define FMT_DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&); \
TypeName(const TypeName&); \
void operator=(const TypeName&)
void operator=(const TypeName&)
namespace
spdlog
{
namespace
details
{
namespace
fmt
namespace
fmt
{
{
...
@@ -1053,7 +1054,7 @@ public:
...
@@ -1053,7 +1054,7 @@ public:
{
{
default:
default:
assert
(
false
);
assert
(
false
);
// Fall through.
// Fall through.
case
Arg
:
:
INT
:
case
Arg
:
:
INT
:
return
FMT_DISPATCH
(
visit_int
(
arg
.
int_value
));
return
FMT_DISPATCH
(
visit_int
(
arg
.
int_value
));
case
Arg
:
:
UINT
:
case
Arg
:
:
UINT
:
...
@@ -2222,7 +2223,7 @@ void BasicWriter<Char>::write_double(
...
@@ -2222,7 +2223,7 @@ void BasicWriter<Char>::write_double(
// MSVC's printf doesn't support 'F'.
// MSVC's printf doesn't support 'F'.
type
=
'f'
;
type
=
'f'
;
#endif
#endif
// Fall through.
// Fall through.
case
'E'
:
case
'E'
:
case
'G'
:
case
'G'
:
case
'A'
:
case
'A'
:
...
@@ -2739,7 +2740,9 @@ inline void format_decimal(char *&buffer, T value)
...
@@ -2739,7 +2740,9 @@ inline void format_decimal(char *&buffer, T value)
internal
::
format_decimal
(
buffer
,
abs_value
,
num_digits
);
internal
::
format_decimal
(
buffer
,
abs_value
,
num_digits
);
buffer
+=
num_digits
;
buffer
+=
num_digits
;
}
}
}
}
// ns fmt
}
// ns deatils
}
// ns spdlog
#if FMT_GCC_VERSION
#if FMT_GCC_VERSION
// Use the system_header pragma to suppress warnings about variadic macros
// Use the system_header pragma to suppress warnings about variadic macros
...
@@ -2846,6 +2849,8 @@ fmt::print(format, args...);
...
@@ -2846,6 +2849,8 @@ fmt::print(format, args...);
#define FMT_VARIADIC_W(ReturnType, func, ...) \
#define FMT_VARIADIC_W(ReturnType, func, ...) \
FMT_VARIADIC_(wchar_t, ReturnType, func, return func, __VA_ARGS__)
FMT_VARIADIC_(wchar_t, ReturnType, func, return func, __VA_ARGS__)
namespace
spdlog
{
namespace
details
{
namespace
fmt
namespace
fmt
{
{
FMT_VARIADIC
(
std
::
string
,
format
,
StringRef
)
FMT_VARIADIC
(
std
::
string
,
format
,
StringRef
)
...
@@ -2858,6 +2863,8 @@ FMT_VARIADIC(std::string, sprintf, StringRef)
...
@@ -2858,6 +2863,8 @@ FMT_VARIADIC(std::string, sprintf, StringRef)
FMT_VARIADIC
(
int
,
printf
,
StringRef
)
FMT_VARIADIC
(
int
,
printf
,
StringRef
)
FMT_VARIADIC
(
int
,
fprintf
,
std
::
FILE
*
,
StringRef
)
FMT_VARIADIC
(
int
,
fprintf
,
std
::
FILE
*
,
StringRef
)
}
}
}
}
// Restore warnings.
// Restore warnings.
#if FMT_GCC_VERSION >= 406
#if FMT_GCC_VERSION >= 406
...
...
include/spdlog/details/pattern_formatter_impl.h
View file @
d817994b
...
@@ -458,7 +458,7 @@ inline void spdlog::pattern_formatter::handle_flag(char flag)
...
@@ -458,7 +458,7 @@ inline void spdlog::pattern_formatter::handle_flag(char flag)
{
{
switch
(
flag
)
switch
(
flag
)
{
{
// logger name
// logger name
case
'n'
:
case
'n'
:
_formatters
.
push_back
(
std
::
unique_ptr
<
details
::
flag_formatter
>
(
new
details
::
name_formatter
()));
_formatters
.
push_back
(
std
::
unique_ptr
<
details
::
flag_formatter
>
(
new
details
::
name_formatter
()));
break
;
break
;
...
@@ -582,8 +582,8 @@ inline void spdlog::pattern_formatter::format(details::log_msg& msg)
...
@@ -582,8 +582,8 @@ inline void spdlog::pattern_formatter::format(details::log_msg& msg)
//write eol
//write eol
msg
.
formatted
<<
details
::
os
::
eol
();
msg
.
formatted
<<
details
::
os
::
eol
();
}
}
catch
(
const
fmt
::
FormatError
&
e
)
catch
(
const
details
::
fmt
::
FormatError
&
e
)
{
{
throw
spdlog_ex
(
fmt
::
format
(
"formatting error while processing format string: {}"
,
e
.
what
()));
throw
spdlog_ex
(
details
::
fmt
::
format
(
"formatting error while processing format string: {}"
,
e
.
what
()));
}
}
}
}
include/spdlog/sinks/file_sinks.h
View file @
d817994b
...
@@ -99,7 +99,7 @@ protected:
...
@@ -99,7 +99,7 @@ protected:
private:
private:
static
std
::
string
calc_filename
(
const
std
::
string
&
filename
,
std
::
size_t
index
,
const
std
::
string
&
extension
)
static
std
::
string
calc_filename
(
const
std
::
string
&
filename
,
std
::
size_t
index
,
const
std
::
string
&
extension
)
{
{
fmt
::
MemoryWriter
w
;
details
::
fmt
::
MemoryWriter
w
;
if
(
index
)
if
(
index
)
w
.
write
(
"{}.{}.{}"
,
filename
,
index
,
extension
);
w
.
write
(
"{}.{}.{}"
,
filename
,
index
,
extension
);
else
else
...
@@ -196,7 +196,7 @@ private:
...
@@ -196,7 +196,7 @@ private:
static
std
::
string
calc_filename
(
const
std
::
string
&
basename
,
const
std
::
string
&
extension
)
static
std
::
string
calc_filename
(
const
std
::
string
&
basename
,
const
std
::
string
&
extension
)
{
{
std
::
tm
tm
=
spdlog
::
details
::
os
::
localtime
();
std
::
tm
tm
=
spdlog
::
details
::
os
::
localtime
();
fmt
::
MemoryWriter
w
;
details
::
fmt
::
MemoryWriter
w
;
w
.
write
(
"{}.{:04d}-{:02d}-{:02d}.{}"
,
basename
,
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
,
extension
);
w
.
write
(
"{}.{:04d}-{:02d}-{:02d}.{}"
,
basename
,
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
,
extension
);
return
w
.
str
();
return
w
.
str
();
}
}
...
...
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