Skip to content

Commit

Permalink
Update hostname dependency to 0.3.1 (#902)
Browse files Browse the repository at this point in the history
  • Loading branch information
James Cape authored Sep 9, 2021
1 parent fcfb24c commit 3028187
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 26 deletions.
23 changes: 2 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ slog-scope = { version = "4.1.2", optional = true }
# loggers-only dependencies
mc-util-build-info = { path = "../util/build/info", optional = true }

hostname = { version = "0.1", optional = true }
hostname = { version = "0.3.1", optional = true }
lazy_static = { version = "1.4", optional = true }
sentry = { version = "0.18", optional = true, default-features = false, features = ["with_client_implementation", "with_reqwest_transport", "with_panic", "with_failure", "with_device_info", "with_rust_info", "with_rustls"] }
slog-async = { version = "2.3", optional = true }
Expand Down
11 changes: 7 additions & 4 deletions common/src/logger/loggers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,15 @@ fn create_stderr_logger() -> slog::Fuse<slog_async::Async> {
/// Create a GELF (https://docs.graylog.org/en/3.0/pages/gelf.html) logger.
fn create_gelf_logger() -> Option<slog::Fuse<slog_async::Async>> {
env::var("MC_LOG_GELF").ok().map(|remote_host_port| {
let local_hostname = hostname::get_hostname().unwrap();
let local_hostname = hostname::get().expect("Could not retrieve hostname");

let drain = slog_envlogger::new(
Gelf::new(&local_hostname, &remote_host_port[..])
.expect("failed creating Gelf logger for")
.fuse(),
Gelf::new(
local_hostname.to_str().expect("Invalid UTF-8 in hostname"),
&remote_host_port[..],
)
.expect("failed creating Gelf logger for")
.fuse(),
);

slog_async::Async::new(drain)
Expand Down

0 comments on commit 3028187

Please sign in to comment.