Skip to content

Commit

Permalink
feat: reexport BroadcastSender from fast/fasyslog#6
Browse files Browse the repository at this point in the history
  • Loading branch information
BBArikL committed Nov 14, 2024
1 parent 5453fd2 commit 0d3dedd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ rand = "0.8"
tempfile = "3.13"
tokio = { version = "1", features = ["rt-multi-thread"] }

[patch.crates-io]
fasyslog = { git = "https://github.com/BBArikL/fasyslog.git" }

## Examples
[[example]]
doc-scrape-examples = true
Expand Down
14 changes: 14 additions & 0 deletions src/append/syslog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,20 @@ impl SyslogWriter {
.map(Self::new)
}

/// Create a new syslog writer that broadcast messages to the well-known UDP port (514).
pub fn broadcast_well_known() -> io::Result<SyslogWriter> {
fasyslog::sender::broadcast_well_known()
.map(SyslogSender::Broadcast)
.map(Self::new)
}

/// Create a new syslog writer that broadcast messages to the given UDP address.
pub fn broadcast(port: u16) -> io::Result<SyslogWriter> {
fasyslog::sender::broadcast(port)
.map(SyslogSender::Broadcast)
.map(Self::new)
}

/// Create a new syslog writer that sends messages to the given Unix stream socket.
#[cfg(unix)]
pub fn unix_stream(path: impl AsRef<std::path::Path>) -> io::Result<SyslogWriter> {
Expand Down

0 comments on commit 0d3dedd

Please sign in to comment.