systemd-journal logging interface wrapper for ruby (donated to theforeman, kept as a mirror)
 
 
Go to file
Anton Smirnov 2cc6900bcf
failed at configuring coverity :(
2018-04-07 00:41:08 +03:00
ext/journald_native Append CFLAGS instead of overwriting 2018-03-29 19:03:37 +03:00
lib/journald Bump version to 1.0.10 2018-03-29 19:03:58 +03:00
spec add rspec test 2016-03-29 18:42:10 +03:00
.gitignore New style Gemfile 2018-03-30 02:38:02 +03:00
.travis.yml add travis.yml... and wait for xenial to be released 2016-03-29 19:03:04 +03:00
COPYING.md change license to LGPL, release as 1.0.9 2016-04-11 17:16:34 +03:00
README.md failed at configuring coverity :( 2018-04-07 00:41:08 +03:00
Rakefile separating native lib and logger - rename gem to journald-native 2014-10-30 23:42:16 +03:00
gems.rb Update gemspec: remove non needed files 2018-04-04 03:11:06 +03:00
journald-native.gemspec Update gemspec: remove non needed files 2018-04-04 03:11:06 +03:00

README.md

journald-native

Gem License

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

Installation

Run

gem install journald-native

or add

gem 'journald-native', '~> 1.0'

to your Gemfile.

Please note that you need a systemd development package installed in your system like systemd-devel in Fedora, libsystemd-dev in Debian, also may be a separate package for journal in older systems like libsystemd-journal-dev.

NB: The gem can be installed on non-linux system but it will do nothing there. (Functions will return success without any actual effect)

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 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.

License

Copyright (c) 2014 Anton Smirnov

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You can find a copy of the GNU Lesser General Public License in COPYING.md or at https://www.gnu.org/licenses/lgpl-2.1.txt.