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
444df2b2
Commit
444df2b2
authored
Sep 03, 2021
by
Chris Love
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address PR comments
parent
8ee1c167
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
14 deletions
+5
-14
example/example.cpp
example/example.cpp
+1
-7
include/spdlog/details/udp_client-windows.h
include/spdlog/details/udp_client-windows.h
+3
-1
include/spdlog/sinks/udp_sink.h
include/spdlog/sinks/udp_sink.h
+1
-6
No files found.
example/example.cpp
View file @
444df2b2
...
@@ -214,13 +214,7 @@ void udp_example()
...
@@ -214,13 +214,7 @@ void udp_example()
spdlog
::
sinks
::
udp_sink_config
cfg
(
"127.0.0.1"
,
11091
);
spdlog
::
sinks
::
udp_sink_config
cfg
(
"127.0.0.1"
,
11091
);
auto
my_logger
=
spdlog
::
udp_logger_mt
(
"udplog"
,
cfg
);
auto
my_logger
=
spdlog
::
udp_logger_mt
(
"udplog"
,
cfg
);
my_logger
->
set_level
(
spdlog
::
level
::
debug
);
my_logger
->
set_level
(
spdlog
::
level
::
debug
);
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
my_logger
->
info
(
"hello world"
);
my_logger
->
info
(
"hello world {}"
,
i
);
#ifdef _WIN32
// sendto() on winsock will drop packets if sent too quickly
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
(
40
));
#endif
}
}
}
// A logger with multiple sinks (stdout and file) - each with a different format and log level.
// A logger with multiple sinks (stdout and file) - each with a different format and log level.
...
...
include/spdlog/details/udp_client-windows.h
View file @
444df2b2
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#pragma once
#pragma once
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
// tcp client helper
// tcp client helper
#include <spdlog/common.h>
#include <spdlog/common.h>
...
@@ -125,4 +126,5 @@ public:
...
@@ -125,4 +126,5 @@ public:
}
// namespace details
}
// namespace details
}
// namespace spdlog
}
// namespace spdlog
#endif
#endif // _WIN32
\ No newline at end of file
#endif // WIN32_LEAN_AND_MEAN
\ No newline at end of file
include/spdlog/sinks/udp_sink.h
View file @
444df2b2
...
@@ -17,12 +17,8 @@
...
@@ -17,12 +17,8 @@
#include <chrono>
#include <chrono>
#include <functional>
#include <functional>
#pragma once
// Simple udp client sink
// Simple udp client sink
// Connects to remote address and send the formatted log.
// Sends formatted log via udp
// 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
{
...
@@ -42,7 +38,6 @@ template<typename Mutex>
...
@@ -42,7 +38,6 @@ template<typename Mutex>
class
udp_sink
:
public
spdlog
::
sinks
::
base_sink
<
Mutex
>
class
udp_sink
:
public
spdlog
::
sinks
::
base_sink
<
Mutex
>
{
{
public:
public:
// connect to tcp host/port or throw if failed
// host can be hostname or ip address
// host can be hostname or ip address
explicit
udp_sink
(
udp_sink_config
sink_config
)
explicit
udp_sink
(
udp_sink_config
sink_config
)
...
...
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