From 3b20abe0f891d2379a6d815fea49aface8e95f95 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 24 Sep 2018 15:38:43 +0200 Subject: docs(main): Expand information on priority->severity conversion Adds a few additional notes about where to find more information and how to log information correctly, as was discussed on issue #11. --- src/main.rs | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 9519b40ce4..ea96568a8a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -339,13 +339,30 @@ fn parse_microseconds(input: String) -> Option> { } } -/// Converts a journald log message priority (using levels 0/emerg through -/// 7/debug, see "man journalctl" and "man systemd.journal-fields") to a -/// Stackdriver-compatible severity number (see -/// https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#LogSeverity). -/// Conveniently, the names are the same. Inconveniently, the numbers are not. +/// Converts a journald log message priority to a +/// Stackdriver-compatible severity number. /// -/// Any unknown values are returned as an empty option. +/// Both Stackdriver and journald specify equivalent +/// severities/priorities. Conveniently, the names are the same. +/// Inconveniently, the numbers are not. +/// +/// For more information on the journald priorities, consult these +/// man-pages: +/// +/// * systemd.journal-fields(7) (section 'PRIORITY') +/// * sd-daemon(3) +/// * systemd.exec(5) (section 'SyslogLevelPrefix') +/// +/// Note that priorities can be logged by applications via the prefix +/// concept described in these man pages, without interfering with +/// structured JSON-payloads. +/// +/// For more information on the Stackdriver severity levels, please +/// consult Google's documentation: +/// +/// https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#LogSeverity +/// +/// Any unknown priority values result in no severity being set. fn priority_to_severity(priority: String) -> Option { match priority.as_ref() { "0" => Some(800), // emerg -- cgit 1.4.1