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
7f84daff
Commit
7f84daff
authored
May 20, 2017
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed compilation
parent
98addad8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
12 deletions
+11
-12
ansicolor_sink.h
include/spdlog/sinks/ansicolor_sink.h
+11
-12
No files found.
include/spdlog/sinks/ansicolor_sink.h
View file @
7f84daff
...
...
@@ -10,7 +10,7 @@
#include <spdlog/details/os.h>
#include <string>
#include <
unordered_
map>
#include <map>
namespace
spdlog
{
...
...
@@ -26,9 +26,8 @@ namespace spdlog
class
ansicolor_sink
SPDLOG_FINAL
:
public
base_sink
<
Mutex
>
{
public
:
ansicolor_sink
(
FILE
*
file
)
:
_target_file
(
file
)
ansicolor_sink
(
FILE
*
file
)
:
target_file_
(
file
)
{
using
namespace
ansi_color_codes
;
should_do_colors_
=
details
::
os
::
in_terminal
(
file
)
&&
details
::
os
::
is_color_terminal
();
colors_
[
level
::
trace
]
=
"
\033
[36m"
;
// cyan;
colors_
[
level
::
debug
]
=
"
\033
[36m"
;
// cyan;
...
...
@@ -45,7 +44,7 @@ namespace spdlog
void
flush
()
override
{
fflush
(
_target_file
);
fflush
(
target_file_
);
}
protected
:
...
...
@@ -56,19 +55,19 @@ namespace spdlog
if
(
should_do_colors_
)
{
const
std
::
string
&
prefix
=
colors_
[
msg
.
level
];
const
std
::
string
&
suffix
=
ansi_color_codes
::
reset
;
fwrite
(
prefix
,
sizeof
(
char
),
prefix
.
size
(),
_target_file
);
fwrite
(
msg
.
formatted
.
data
(),
sizeof
(
char
),
msg
.
formatted
.
size
(),
_target_file
);
fwrite
(
suffix
,
sizeof
(
char
),
suffix
.
size
(),
_target_file
);
const
std
::
string
&
reset
=
colors_
[
level
::
off
]
;
fwrite
(
prefix
.
c_str
(),
sizeof
(
char
),
prefix
.
size
(),
target_file_
);
fwrite
(
msg
.
formatted
.
data
(),
sizeof
(
char
),
msg
.
formatted
.
size
(),
target_file_
);
fwrite
(
reset
.
c_str
(),
sizeof
(
char
),
reset
.
size
(),
target_file_
);
}
else
{
fwrite
(
msg
.
formatted
.
data
(),
sizeof
(
char
),
msg
.
formatted
.
size
(),
_target_file
);
fwrite
(
msg
.
formatted
.
data
(),
sizeof
(
char
),
msg
.
formatted
.
size
(),
target_file_
);
}
}
private
:
}
FILE
*
target_file_
;
bool
should_do_colors_
;
std
::
unordered_
map
<
level
::
level_enum
,
std
::
string
>
colors_
;
std
::
map
<
level
::
level_enum
,
std
::
string
>
colors_
;
};
...
...
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