Skip to content

Commit e775677

Browse files
authored
Merge pull request #557 from input-output-hk/make-gelf-optional
mark gelf as optional feature
2 parents 01577bd + cb10620 commit e775677

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

jormungandr/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ serde_json = "1.0.38"
2525
serde_yaml = "0.8"
2626
slog = "^2.4"
2727
slog-async = "2.3.0"
28+
slog-gelf = { version = "0.1.0", optional = true }
2829
slog-journald = { version = "2.0.0", optional = true }
2930
slog-json = "2.3.0"
3031
slog-term = "2.4.0"
@@ -63,7 +64,6 @@ jormungandr-lib = { path = "../jormungandr-lib" }
6364
strfmt = "0.1"
6465
gtmpl = "0.5.6"
6566
mktemp = "0.4.0"
66-
slog-gelf = "0.1.0"
6767

6868
[dependencies.actix-web]
6969
version = "0.7.18"
@@ -94,3 +94,4 @@ with-bench = []
9494
integration-test = []
9595
soak-test = []
9696
systemd = ["slog-journald"]
97+
gelf = ["slog-gelf"]

jormungandr/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ extern crate serde_yaml;
4545
#[macro_use(b, o, record_static, debug, info, warn, error, crit)]
4646
extern crate slog;
4747
extern crate slog_async;
48+
#[cfg(feature = "gelf")]
4849
extern crate slog_gelf;
4950
#[cfg(feature = "systemd")]
5051
extern crate slog_journald;

jormungandr/src/settings/logging.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::log::{AsyncableDrain, JsonDrain};
22
use slog::{Drain, Logger};
33
use slog_async::Async;
4+
#[cfg(feature = "gelf")]
45
use slog_gelf::Gelf;
56
#[cfg(feature = "systemd")]
67
use slog_journald::JournaldDrain;
@@ -31,6 +32,7 @@ pub enum LogFormat {
3132
/// Output of the logger.
3233
pub enum LogOutput {
3334
Stderr,
35+
#[cfg(feature = "gelf")]
3436
Gelf,
3537
#[cfg(unix)]
3638
Syslog,
@@ -56,6 +58,7 @@ impl FromStr for LogOutput {
5658
fn from_str(s: &str) -> Result<Self, Self::Err> {
5759
match &*s.trim().to_lowercase() {
5860
"stderr" => Ok(LogOutput::Stderr),
61+
#[cfg(feature = "gelf")]
5962
"gelf" => Ok(LogOutput::Gelf),
6063
#[cfg(unix)]
6164
"syslog" => Ok(LogOutput::Syslog),
@@ -86,6 +89,7 @@ impl LogOutput {
8689
) -> Result<Async, Error> {
8790
match self {
8891
LogOutput::Stderr => Ok(format.decorate_stderr()),
92+
#[cfg(feature = "gelf")]
8993
LogOutput::Gelf => match backend {
9094
Some(graylog_host_port) => {
9195
match logs_id {

0 commit comments

Comments
 (0)