about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2018-09-24T13·38+0200
committerVincent Ambo <github@tazj.in>2018-09-24T14·03+0200
commit3b20abe0f891d2379a6d815fea49aface8e95f95 (patch)
tree4b267288d312e7e61de056bf233c3a82717dc887
parenta89be8d715a88af85419b544367e4d74e06c68e6 (diff)
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.
-rw-r--r--src/main.rs29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/main.rs b/src/main.rs
index 9519b40ce4a2..ea96568a8a59 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -339,13 +339,30 @@ fn parse_microseconds(input: String) -> Option<DateTime<Utc>> {
     }
 }
 
-/// 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<u32> {
     match priority.as_ref() {
         "0" => Some(800), // emerg