Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework using the POSIX syslog API #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
[package]
name = "slog-syslog"
version = "0.12.0"
version = "0.13.0"
authors = ["Dawid Ciężarkiewicz <[email protected]>", "William Laeder <[email protected]" ]
description = "Syslog drain for slog-rs"
keywords = ["slog", "logging", "json", "log", "syslog"]
license = "MPL-2.0"
documentation = "https://docs.rs/slog-rs/term"
documentation = "https://docs.rs/slog-syslog"
homepage = "https://github.com/slog-rs/slog"
repository = "https://github.com/slog-rs/syslog"
readme = "README.md"

[lib]
path = "lib.rs"

[dependencies]
lazy_static = "1"
libc = "0.2"
serde = { version = "1.0.85", optional = true, features = ["derive"] }
slog = "^2.1.1"
syslog = "3.3.0"
nix = "0.14.0"

[dev-dependencies]
toml = "0.4"

[package.metadata.docs.rs]
all-features = true
14 changes: 9 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,29 @@ CARGO_FLAGS += --release
else
$(info DEBUG BUILD: $(PKG_NAME); use `RELEASE=true make [args]` for release build)
endif
CARGO_FEATURES=serde

EXAMPLES = $(shell cd examples 2>/dev/null && ls *.rs 2>/dev/null | sed -e 's/.rs$$//g' )

all: $(ALL_TARGETS)

.PHONY: run test build doc clean clippy
run test build clean:
run test build:
cargo $@ --features $(CARGO_FEATURES) $(CARGO_FLAGS)

clean:
cargo $@ $(CARGO_FLAGS)

check:
$(info Running check; use `make build` to actually build)
cargo $@ $(CARGO_FLAGS)
cargo $@ --features $(CARGO_FEATURES) $(CARGO_FLAGS)

clippy:
cargo build --features clippy
cargo build --features clippy,$(CARGO_FEATURES)

.PHONY: bench
bench:
cargo $@ $(filter-out --release,$(CARGO_FLAGS))
cargo $@ --features $(CARGO_FEATURES) $(filter-out --release,$(CARGO_FLAGS))

.PHONY: travistest
travistest: test
Expand All @@ -50,7 +54,7 @@ $(EXAMPLES):

.PHONY: doc
doc: FORCE
cargo doc
cargo --features $(CARGO_FEATURES) doc

.PHONY: publishdoc
publishdoc:
Expand Down
16 changes: 12 additions & 4 deletions examples/syslog-unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@
extern crate slog;
extern crate slog_syslog;

use slog::Drain;
use slog_syslog::Facility;
use slog_syslog::adapter::{Adapter, DefaultAdapter};
use slog_syslog::{Facility, SyslogBuilder};
use slog::Level;

fn main() {
let syslog = slog_syslog::unix_3164(Facility::LOG_USER).unwrap();
let root = slog::Logger::root(syslog.fuse(), o!());
let syslog = SyslogBuilder::new()
.facility(Facility::User)
.adapter(DefaultAdapter.with_priority(|record, values| match record.level() {
Level::Info => slog_syslog::Level::Notice.into(),
_ => DefaultAdapter.priority(record, values),
}))
.build();

let root = slog::Logger::root(syslog, o!());

info!(root, "Starting");

Expand Down
279 changes: 0 additions & 279 deletions lib.rs

This file was deleted.

Loading