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
26a064ed
Commit
26a064ed
authored
May 12, 2019
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip static-lib
parent
d5c9bac3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
20 deletions
+54
-20
basic_file_sink-inl.h
include/spdlog/sinks/basic_file_sink-inl.h
+39
-0
basic_file_sink.h
include/spdlog/sinks/basic_file_sink.h
+9
-20
spdlog.cpp
src/spdlog.cpp
+5
-0
includes.h
tests/includes.h
+1
-0
No files found.
include/spdlog/sinks/basic_file_sink-inl.h
0 → 100644
View file @
26a064ed
// Copyright(c) 2015-present Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
#include "spdlog/common.h"
#include "spdlog/details/os.h"
namespace
spdlog
{
namespace
sinks
{
template
<
typename
Mutex
>
SPDLOG_INLINE
basic_file_sink
<
Mutex
>::
basic_file_sink
(
const
filename_t
&
filename
,
bool
truncate
)
{
file_helper_
.
open
(
filename
,
truncate
);
}
template
<
typename
Mutex
>
SPDLOG_INLINE
const
filename_t
&
basic_file_sink
<
Mutex
>::
filename
()
const
{
return
file_helper_
.
filename
();
}
template
<
typename
Mutex
>
SPDLOG_INLINE
void
basic_file_sink
<
Mutex
>::
sink_it_
(
const
details
::
log_msg
&
msg
)
{
fmt
::
memory_buffer
formatted
;
sink
::
formatter_
->
format
(
msg
,
formatted
);
file_helper_
.
write
(
formatted
);
}
template
<
typename
Mutex
>
SPDLOG_INLINE
void
basic_file_sink
<
Mutex
>::
flush_
()
{
file_helper_
.
flush
();
}
}
// namespace sinks
}
// namespace spdlog
include/spdlog/sinks/basic_file_sink.h
View file @
26a064ed
...
...
@@ -23,28 +23,12 @@ template<typename Mutex>
class
basic_file_sink
final
:
public
base_sink
<
Mutex
>
{
public
:
explicit
basic_file_sink
(
const
filename_t
&
filename
,
bool
truncate
=
false
)
{
file_helper_
.
open
(
filename
,
truncate
);
}
const
filename_t
&
filename
()
const
{
return
file_helper_
.
filename
();
}
explicit
basic_file_sink
(
const
filename_t
&
filename
,
bool
truncate
=
false
);
const
filename_t
&
filename
()
const
;
protected
:
void
sink_it_
(
const
details
::
log_msg
&
msg
)
override
{
fmt
::
memory_buffer
formatted
;
sink
::
formatter_
->
format
(
msg
,
formatted
);
file_helper_
.
write
(
formatted
);
}
void
flush_
()
override
{
file_helper_
.
flush
();
}
void
sink_it_
(
const
details
::
log_msg
&
msg
)
override
;
void
flush_
()
override
;
private
:
details
::
file_helper
file_helper_
;
...
...
@@ -71,3 +55,7 @@ inline std::shared_ptr<logger> basic_logger_st(const std::string &logger_name, c
}
}
// namespace spdlog
#ifdef SPDLOG_HEADER_ONLY
#include "basic_file_sink-inl.h"
#endif
\ No newline at end of file
src/spdlog.cpp
View file @
26a064ed
...
...
@@ -36,6 +36,11 @@ template spdlog::logger::logger(std::string name, sinks_init_list::iterator begi
template
class
spdlog
::
sinks
::
base_sink
<
std
::
mutex
>
;
template
class
spdlog
::
sinks
::
base_sink
<
spdlog
::
details
::
null_mutex
>
;
#include "spdlog/sinks/basic_file_sink.h"
#include "spdlog/sinks/basic_file_sink-inl.h"
template
class
spdlog
::
sinks
::
basic_file_sink
<
std
::
mutex
>
;
template
class
spdlog
::
sinks
::
basic_file_sink
<
spdlog
::
details
::
null_mutex
>
;
#include "spdlog/sinks/rotating_file_sink.h"
#include "spdlog/sinks/rotating_file_sink-inl.h"
template
class
spdlog
::
sinks
::
rotating_file_sink
<
std
::
mutex
>
;
...
...
tests/includes.h
View file @
26a064ed
...
...
@@ -20,3 +20,4 @@
#include "spdlog/sinks/ostream_sink.h"
#include "spdlog/sinks/rotating_file_sink.h"
#include "spdlog/sinks/stdout_color_sinks.h"
#include "spdlog/details/pattern_formatter.h"
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