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
bac1e4a8
Commit
bac1e4a8
authored
Mar 23, 2019
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clang-format
parent
934cc892
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
30 deletions
+23
-30
example.cpp
example/example.cpp
+1
-1
example.cpp
lite-example/example.cpp
+1
-1
spdlite.cpp
lite/spdlite.cpp
+15
-19
spdlite.h
lite/spdlite.h
+6
-9
No files found.
example/example.cpp
View file @
bac1e4a8
...
...
@@ -70,7 +70,7 @@ int main(int, char *[])
spdlog
::
shutdown
();
}
// Exceptions will only be thrown upon failed logger or sink construction (not during logging).
// Exceptions will only be thrown upon failed logger or sink construction (not during logging).
catch
(
const
spdlog
::
spdlog_ex
&
ex
)
{
std
::
printf
(
"Log initialization failed: %s
\n
"
,
ex
.
what
());
...
...
lite-example/example.cpp
View file @
bac1e4a8
...
...
@@ -5,7 +5,7 @@ int main()
auto
l
=
spdlog
::
create_lite
();
l
.
set_level
(
spdlog
::
lite
::
level
::
trace
);
l
.
trace_f
(
"Hello %s "
,
"GABI"
);
l
.
trace_f
(
"Hello %s "
,
"GABI"
);
l
.
info_f
(
"Hello %d"
,
12346
);
l
.
warn_f
(
"Hello %f"
,
12346.5656
);
l
.
warn
(
"Hello {}"
,
12346.5656
);
...
...
lite/spdlite.cpp
View file @
bac1e4a8
...
...
@@ -28,65 +28,63 @@ void spdlog::lite::logger::log(spdlog::lite::level lvl, const string_view_t &sv)
impl_
->
log
(
spd_level
,
sv
);
}
void
spdlog
::
lite
::
logger
::
log_printf
(
spdlog
::
lite
::
level
lvl
,
const
char
*
format
,
va_list
args
)
void
spdlog
::
lite
::
logger
::
log_printf
(
spdlog
::
lite
::
level
lvl
,
const
char
*
format
,
va_list
args
)
{
char
buffer
[
500
];
auto
size
=
vsnprintf
(
buffer
,
sizeof
(
buffer
),
format
,
args
);
if
(
size
<
0
)
auto
size
=
vsnprintf
(
buffer
,
sizeof
(
buffer
),
format
,
args
);
if
(
size
<
0
)
{
size
=
snprintf
(
buffer
,
sizeof
(
buffer
),
"invalid format (%s)"
,
format
);
}
log
(
lvl
,
string_view_t
{
buffer
,
static_cast
<
size_t
>
(
size
)});
}
void
spdlog
::
lite
::
logger
::
trace_f
(
const
char
*
format
,
...)
{
va_list
args
;
va_start
(
args
,
format
);
va_start
(
args
,
format
);
log_printf
(
lite
::
level
::
trace
,
format
,
args
);
va_end
(
args
);
va_end
(
args
);
}
void
spdlog
::
lite
::
logger
::
debug_f
(
const
char
*
format
,
...)
{
va_list
args
;
va_start
(
args
,
format
);
va_start
(
args
,
format
);
log_printf
(
lite
::
level
::
debug
,
format
,
args
);
va_end
(
args
);
va_end
(
args
);
}
void
spdlog
::
lite
::
logger
::
info_f
(
const
char
*
format
,
...)
{
va_list
args
;
va_start
(
args
,
format
);
va_start
(
args
,
format
);
log_printf
(
lite
::
level
::
info
,
format
,
args
);
va_end
(
args
);
va_end
(
args
);
}
void
spdlog
::
lite
::
logger
::
warn_f
(
const
char
*
format
,
...)
{
va_list
args
;
va_start
(
args
,
format
);
va_start
(
args
,
format
);
log_printf
(
lite
::
level
::
warn
,
format
,
args
);
va_end
(
args
);
va_end
(
args
);
}
void
spdlog
::
lite
::
logger
::
error_f
(
const
char
*
format
,
...)
{
va_list
args
;
va_start
(
args
,
format
);
va_start
(
args
,
format
);
log_printf
(
lite
::
level
::
err
,
format
,
args
);
va_end
(
args
);
va_end
(
args
);
}
void
spdlog
::
lite
::
logger
::
critical_f
(
const
char
*
format
,
...)
{
va_list
args
;
va_start
(
args
,
format
);
va_start
(
args
,
format
);
log_printf
(
lite
::
level
::
critical
,
format
,
args
);
va_end
(
args
);
va_end
(
args
);
}
void
spdlog
::
lite
::
logger
::
set_level
(
spdlog
::
lite
::
level
level
)
...
...
@@ -138,5 +136,3 @@ spdlog::lite::logger &spdlog::lite::default_logger()
static
spdlog
::
lite
::
logger
s_default
(
spdlog
::
default_logger
());
return
s_default
;
}
lite/spdlite.h
View file @
bac1e4a8
...
...
@@ -31,7 +31,6 @@ enum class level
off
};
class
logger
{
public
:
...
...
@@ -60,7 +59,7 @@ public:
// log string view
void
log
(
spdlog
::
lite
::
level
lvl
,
const
string_view_t
&
sv
);
void
log_printf
(
spdlog
::
lite
::
level
lvl
,
const
char
*
format
,
va_list
args
);
void
log_printf
(
spdlog
::
lite
::
level
lvl
,
const
char
*
format
,
va_list
args
);
//
// trace
...
...
@@ -76,7 +75,7 @@ public:
log
(
spdlog
::
lite
::
level
::
trace
,
fmt
,
args
...);
}
void
trace_f
(
const
char
*
printf_format
,
...);
void
trace_f
(
const
char
*
printf_format
,
...);
//
// debug
...
...
@@ -92,7 +91,7 @@ public:
log
(
spdlog
::
lite
::
level
::
debug
,
fmt
,
args
...);
}
void
debug_f
(
const
char
*
printf_format
,
...);
void
debug_f
(
const
char
*
printf_format
,
...);
//
// info
...
...
@@ -124,7 +123,7 @@ public:
log
(
spdlog
::
lite
::
level
::
warn
,
fmt
,
args
...);
}
void
warn_f
(
const
char
*
printf_format
,
...);
void
warn_f
(
const
char
*
printf_format
,
...);
//
// error
...
...
@@ -134,14 +133,13 @@ public:
log
(
spdlog
::
lite
::
level
::
err
,
string_view_t
(
msg
));
}
template
<
typename
...
Args
>
void
error
(
const
char
*
fmt
,
const
Args
&
...
args
)
{
log
(
spdlog
::
lite
::
level
::
err
,
fmt
,
args
...);
}
void
error_f
(
const
char
*
printf_format
,
...);
void
error_f
(
const
char
*
printf_format
,
...);
//
// critical
...
...
@@ -157,7 +155,7 @@ public:
log
(
spdlog
::
lite
::
level
::
critical
,
fmt
,
args
...);
}
void
critical_f
(
const
char
*
printf_format
,
...);
void
critical_f
(
const
char
*
printf_format
,
...);
//
// setters/getters
...
...
@@ -177,7 +175,6 @@ public:
protected
:
std
::
shared_ptr
<
spdlog
::
logger
>
impl_
;
void
log_formatted_
(
spdlog
::
lite
::
level
lvl
,
const
fmt
::
memory_buffer
&
formatted
);
};
spdlog
::
lite
::
logger
&
default_logger
();
...
...
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