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
0b91d552
Commit
0b91d552
authored
Feb 25, 2020
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored tcp_client_sink
parent
9f419030
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
+10
-5
include/spdlog/details/tcp_client.h
include/spdlog/details/tcp_client.h
+4
-0
include/spdlog/sinks/tcp_sink.h
include/spdlog/sinks/tcp_sink.h
+6
-5
No files found.
include/spdlog/details/tcp_client.h
View file @
0b91d552
...
@@ -3,6 +3,10 @@
...
@@ -3,6 +3,10 @@
#pragma once
#pragma once
#ifdef _WIN32
#error tcp_client not supported under windows yet
#endif
// tcp client helper
// tcp client helper
#include <spdlog/common.h>
#include <spdlog/common.h>
#include <spdlog/details/os.h>
#include <spdlog/details/os.h>
...
...
include/spdlog/sinks/tcp_sink.h
View file @
0b91d552
...
@@ -14,9 +14,10 @@
...
@@ -14,9 +14,10 @@
#pragma once
#pragma once
// tcp client sink
// Simple tcp client sink
// connect to remote address and send the formatted log.
// Connects to remote address and send the formatted log.
// will attempt to reconnect if connection drops.
// Will attempt to reconnect if connection drops.
// If more complicated behaviour is needed (i.e get responses), you can inherit it and override the sink_it_ method.
namespace
spdlog
{
namespace
spdlog
{
namespace
sinks
{
namespace
sinks
{
...
@@ -39,7 +40,7 @@ class tcp_sink : public spdlog::sinks::base_sink<Mutex>
...
@@ -39,7 +40,7 @@ class tcp_sink : public spdlog::sinks::base_sink<Mutex>
public:
public:
// connect to tcp host/port or throw if failed
// connect to tcp host/port or throw if failed
// host can be hostname or ip address
// host can be hostname or ip address
tcp_sink
(
tcp_sink_config
sink_config
)
explicit
tcp_sink
(
tcp_sink_config
sink_config
)
:
config_
{
std
::
move
(
sink_config
)}
:
config_
{
std
::
move
(
sink_config
)}
{
{
if
(
!
config_
.
lazy_connect
)
if
(
!
config_
.
lazy_connect
)
...
@@ -48,7 +49,7 @@ public:
...
@@ -48,7 +49,7 @@ public:
}
}
}
}
~
tcp_sink
()
override
{}
~
tcp_sink
()
override
=
default
;
protected:
protected:
void
sink_it_
(
const
spdlog
::
details
::
log_msg
&
msg
)
override
void
sink_it_
(
const
spdlog
::
details
::
log_msg
&
msg
)
override
...
...
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