libgui 2.01
libgui is a GUI library for the GameCube, Wii, and Wii U
 
Loading...
Searching...
No Matches
WutLoggerUdp.h
1/****************************************************************************
2 * Platform Abstraction Layer
3 * Daryl Borth 2026
4 * WutLoggerUdp.h
5 *
6 * Non-blocking UDP log streaming over BSD sockets (nsysnet, bundled with
7 * wut). Wii U's network stack is already up whenever the OS has network
8 * configured, so unlike the Wii backend there is no explicit net_init()
9 * equivalent to call here.
10 ***************************************************************************/
11#pragma once
12
13#include "../Logger.h"
14#include <netinet/in.h>
15
19{
20 public:
21 bool init(const LogConfig & config) override;
22 void shutdown() override;
23 void write(LogLevel level, const char * line, size_t len) override;
24 const char * name() const override { return "UDP"; }
25
26 private:
27 int sock = -1;
28 struct sockaddr_in serverAddr {};
29};
Abstract backend a Logger fans a formatted line out to.
Definition Logger.h:153
Non-blocking UDP log backend over nsysnet sockets.
void shutdown() override
Releases whatever init() acquired.
void write(LogLevel level, const char *line, size_t len) override
Writes one already-formatted, newline-terminated line.
const char * name() const override
Short identifier for diagnostics (eg. "UDP", "File").
bool init(const LogConfig &config) override
Opens whatever handle/socket/file this backend needs, using only fields from config (nothing hardcode...
LogLevel
Severity of a single log call.
Definition Logger.h:45
Full runtime configuration for the Logger.
Definition Logger.h:101