systemd-journal logging interface wrapper for ruby (donated to theforeman, kept as a mirror)
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Go to file
Anton Smirnov 4ae187945a * do not accept strings with \0 as valid
* mark as 1.0.6
8 years ago
ext/journald_native * do not accept strings with \0 as valid 8 years ago
lib/journald * do not accept strings with \0 as valid 8 years ago
.gitignore * compile dummy for non-linux 8 years ago
Gemfile gem structure 9 years ago
LICENSE.txt gem structure 9 years ago * do not accept strings with \0 as valid 8 years ago
Rakefile separating native lib and logger - rename gem to journald-native 9 years ago
journald-native.gemspec fix dependency on ruby 9 years ago


Gem Version Reference Status

A systemd-journal native logging lib wrapper. See sd-journal help for more info


require 'journald/native'


Constants are used to denote a log level

Available constants:

Journald::LOG_EMERG     # system is unusable
Journald::LOG_ALERT     # action must be taken immediately
Journald::LOG_CRIT      # critical conditions
Journald::LOG_ERR       # error conditions
Journald::LOG_WARNING   # warning conditions
Journald::LOG_NOTICE    # normal but significant condition
Journald::LOG_INFO      # informational
Journald::LOG_DEBUG     # debug-level messages

systemd-journal uses syslog constants to denote level therefore they are equal to those of the Syslog module, e.g. Journald::LOG_WARNING == Syslog::LOG_WARNING. See syslog man page for more info


Methods of Journald::Native class wrap systemd-journal calls. See sd-journal help for more info

Journald::Native.send "MESSAGE=message", "PRIORITY=#{Journald::LOG_WARNING}"
Journald::Native.print Journald::LOG_WARNING, "message"
Journald::Native.perror "message"

It is not recommended to use print and perror as you may get exception if your string contains '\0' byte due to C zero-terminated string format. On the contrary send uses binary buffers and does not have this shortcoming.


Licensed under the MIT License. See LICENSE.txt for more info