systemd-journal logging interface wrapper for ruby (donated to theforeman, kept as a mirror)
 
 
Go to file
Anton Smirnov 28501a8a62 * fix possible memory leak
* fix some comments
2014-11-01 01:56:12 +03:00
ext/journald_native * fix possible memory leak 2014-11-01 01:56:12 +03:00
lib/journald fix dependency on ruby 2014-10-31 01:48:03 +03:00
.gitignore ignore idea's files 2014-11-01 01:48:23 +03:00
Gemfile gem structure 2014-10-30 01:50:19 +03:00
LICENSE.txt gem structure 2014-10-30 01:50:19 +03:00
README.md readme fix 2014-10-31 16:47:44 +03:00
Rakefile separating native lib and logger - rename gem to journald-native 2014-10-30 23:42:16 +03:00
journald-native.gemspec fix dependency on ruby 2014-10-31 01:48:03 +03:00

README.md

journald-native

Gem Version

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

Usage

require 'journald/native'

Constants

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

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 lose '\0' byte in your string due to C zero-terminated string format (all zero bytes in the middle will be removed) On the contrary send uses binary buffers and does not have this shortcoming.

License

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