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
8649fb51
Commit
8649fb51
authored
Sep 25, 2018
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added binary logging example
parent
a4bae6ab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
2 deletions
+28
-2
README.md
README.md
+28
-2
No files found.
README.md
View file @
8649fb51
...
@@ -32,7 +32,6 @@ Very fast, header only, C++ logging library. [![Build Status](https://travis-ci.
...
@@ -32,7 +32,6 @@ Very fast, header only, C++ logging library. [![Build Status](https://travis-ci.
*
Feature rich using the excellent
[
fmt
](
https://github.com/fmtlib/fmt
)
library.
*
Feature rich using the excellent
[
fmt
](
https://github.com/fmtlib/fmt
)
library.
*
Fast asynchronous mode (optional)
*
Fast asynchronous mode (optional)
*
[
Custom
](
https://github.com/gabime/spdlog/wiki/3.-Custom-formatting
)
formatting.
*
[
Custom
](
https://github.com/gabime/spdlog/wiki/3.-Custom-formatting
)
formatting.
*
Conditional Logging
*
Multi/Single threaded loggers.
*
Multi/Single threaded loggers.
*
Various log targets:
*
Various log targets:
*
Rotating log files.
*
Rotating log files.
...
@@ -42,7 +41,7 @@ Very fast, header only, C++ logging library. [![Build Status](https://travis-ci.
...
@@ -42,7 +41,7 @@ Very fast, header only, C++ logging library. [![Build Status](https://travis-ci.
*
Windows debugger (
```OutputDebugString(..)```
)
*
Windows debugger (
```OutputDebugString(..)```
)
*
Easily extendable with custom log targets (just implement a single function in the
[
sink
](
include/spdlog/sinks/sink.h
)
interface).
*
Easily extendable with custom log targets (just implement a single function in the
[
sink
](
include/spdlog/sinks/sink.h
)
interface).
*
Severity based filtering - threshold levels can be modified in runtime as well as in compile time.
*
Severity based filtering - threshold levels can be modified in runtime as well as in compile time.
*
Binary to hex conversion and logging.
## Benchmarks
## Benchmarks
...
@@ -180,6 +179,33 @@ spdlog::flush_every(std::chrono::seconds(3));
...
@@ -180,6 +179,33 @@ spdlog::flush_every(std::chrono::seconds(3));
```
```
---
#### Binary logging
```
c++
// log binary data as hex.
// many types of std::container<char> types can be used.
// ranges are supported too.
// format flags:
// {:X} - print in uppercase.
// {:s} - don't separate each byte with space.
// {:p} - don't print the position on each line start.
// {:n} - don't split the output to lines.
#include "spdlog/fmt/bin_to_hex.h"
void
binary_example
()
{
auto
console
=
spdlog
::
get
(
"console"
);
std
::
array
<
char
,
80
>
buf
;
console
->
info
(
"Binary example: {}"
,
spdlog
::
to_hex
(
buf
));
console
->
info
(
"Another binary example:{:n}"
,
spdlog
::
to_hex
(
std
::
begin
(
buf
),
std
::
begin
(
buf
)
+
10
));
// more examples:
// logger->info("uppercase: {:X}", spdlog::to_hex(buf));
// logger->info("uppercase, no delimiters: {:Xs}", spdlog::to_hex(buf));
// logger->info("uppercase, no delimiters, no position info: {:Xsp}", spdlog::to_hex(buf));
}
```
---
---
#### Logger with multi sinks - each with different format and log level
#### Logger with multi sinks - each with different format and log level
...
...
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