No release in over 3 years
Low commit activity in last 3 years
The apple-system-logger library provides an interface for the Apple System Library. You can both write to, and search, your mac's system logs using this library using an API that is very similar to the stdlib Logger interface.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 3.9

Runtime

~> 1.1
 Project Readme

Ruby

apple-system-logger

A Ruby interface for the Apple system logger.

Installation

gem install apple-system-logger

Adding the trusted cert

gem cert --add <(curl -Ls https://raw.githubusercontent.com/djberg96/apple-system-logger/main/certs/djberg96_pub.pem)

Synopsis

require 'apple-system-logger'

# With defaults
log = Apple::System::Logger.new
log.warn("This is a warning")

# With all possible options, including multicast to $stderr
log = Apple::System::Logger.new(
  facility: 'com.apple.console',
  level: Apple::System::Logger::ASL_LEVEL_WARNING,
  progname: 'myprog',
  logdev: $stderr
)

log.warn("This is also a warning")

# Search for logs
log = Apple::System::Logger.new
results = log.search(:sender => 'bootlog', :level => 5)

# Always do this when finished, or use the block version of the constructor
log.close

License

Apache-2.0

Known Issues

It does not seem that you can multicast to any fileno except stdout and stderr. I am not sure if this is by design, or if I am missing something, because the API does not explicitly forbid other file descriptors, nor does it raise an error.

Copyright

(C) 2020-2021 Daniel J. Berger, All Rights Reserved

Warranty

This package is provided "as is" and without any express or implied warranties, including, without limitation, the implied warranties of merchantability and fitness for a particular purpose.

Author

Daniel J. Berger