apple-system-logger 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGES.md +11 -0
- data/Gemfile +2 -0
- data/MANIFEST.md +1 -0
- data/README.md +7 -2
- data/Rakefile +16 -7
- data/apple-system-logger.gemspec +12 -9
- data/lib/apple/system/logger/constants.rb +11 -9
- data/lib/apple/system/logger/functions.rb +15 -13
- data/lib/apple/system/logger.rb +31 -23
- data/lib/apple-system-logger.rb +2 -0
- data/spec/apple-system-logger_spec.rb +41 -35
- data.tar.gz.sig +0 -0
- metadata +43 -22
- metadata.gz.sig +2 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 47eaba8480a9a1a1645cb05b1097fae01083b9d9f10052ee2818472739b8eaff
|
|
4
|
+
data.tar.gz: 8d726f6fbeb7764af96d897cc925b7c609dce96b327e26140e514e8df381bcae
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9a98f320a286f69bf5eab1813c70e5f6c635be8117b3bc5a8f8fc37c78fc1111ed54d86795e0b44ed57ffca2ee72b6d5c76a5d5cebabd5885081714fa2619510
|
|
7
|
+
data.tar.gz: 0b53d9d699d57e1c36482eb2134b4b6c2aff8078a39e67c2a0d9682754b898f228251b583e112929a1d41daa70d464ad272afe80fb5fa106d5fee5f81c00b473
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/CHANGES.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## 0.1.3 - 28-Dec-2025
|
|
2
|
+
* Fixed the missing message parameter for the error and fatal methods.
|
|
3
|
+
* Added stricter enforcement for search keys.
|
|
4
|
+
* The constructor was modified internally for proper initialization.
|
|
5
|
+
* Some rubocop cleanup, spec updates, and workflow action tweaks.
|
|
6
|
+
|
|
7
|
+
## 0.1.2 - 28-Oct-2020
|
|
8
|
+
* Added the :stderr option.
|
|
9
|
+
* Added a Gemfile.
|
|
10
|
+
* Set version requirements for ffi and rspec.
|
|
11
|
+
|
|
1
12
|
## 0.1.1 - 25-Mar-2020
|
|
2
13
|
* Added LICENSE file as part of distribution.
|
|
3
14
|
* Minor spec updates.
|
data/Gemfile
ADDED
data/MANIFEST.md
CHANGED
data/README.md
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
[](https://github.com/djberg96/apple-system-logger/actions/workflows/ruby.yml)
|
|
2
|
+
|
|
1
3
|
## apple-system-logger
|
|
2
4
|
A Ruby interface for the Apple system logger.
|
|
3
5
|
|
|
4
6
|
## Installation
|
|
5
7
|
gem install apple-system-logger
|
|
6
8
|
|
|
9
|
+
## Adding the trusted cert
|
|
10
|
+
`gem cert --add <(curl -Ls https://raw.githubusercontent.com/djberg96/apple-system-logger/main/certs/djberg96_pub.pem)`
|
|
11
|
+
|
|
7
12
|
## Synopsis
|
|
8
|
-
```
|
|
13
|
+
```ruby
|
|
9
14
|
require 'apple-system-logger'
|
|
10
15
|
|
|
11
16
|
# With defaults
|
|
@@ -40,7 +45,7 @@ because the API does not explicitly forbid other file descriptors, nor
|
|
|
40
45
|
does it raise an error.
|
|
41
46
|
|
|
42
47
|
## Copyright
|
|
43
|
-
(C) 2020 Daniel J. Berger, All Rights Reserved
|
|
48
|
+
(C) 2020-2025 Daniel J. Berger, All Rights Reserved
|
|
44
49
|
|
|
45
50
|
## Warranty
|
|
46
51
|
This package is provided "as is" and without any express or
|
data/Rakefile
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
require 'rake'
|
|
2
2
|
require 'rake/clean'
|
|
3
|
-
require 'rbconfig'
|
|
4
3
|
require 'rspec/core/rake_task'
|
|
5
|
-
|
|
4
|
+
require 'rubocop/rake_task'
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
CLEAN.include('**/*.gem', '**/*.rbc', '**/*.rbx')
|
|
6
|
+
CLEAN.include('**/*.gem', '**/*.rbc', '**/*.rbx', '**/*.lock')
|
|
10
7
|
|
|
11
8
|
namespace 'gem' do
|
|
12
9
|
desc "Create the apple-system-logger gem"
|
|
13
10
|
task :create => [:clean] do
|
|
14
11
|
require 'rubygems/package'
|
|
15
|
-
spec =
|
|
12
|
+
spec = Gem::Specification.load('apple-system-logger.gemspec')
|
|
16
13
|
spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
|
|
17
|
-
Gem::Package.build(spec
|
|
14
|
+
Gem::Package.build(spec)
|
|
18
15
|
end
|
|
19
16
|
|
|
20
17
|
desc "Install the apple-system-logger gem"
|
|
@@ -24,4 +21,16 @@ namespace 'gem' do
|
|
|
24
21
|
end
|
|
25
22
|
end
|
|
26
23
|
|
|
24
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
|
25
|
+
t.verbose = true
|
|
26
|
+
t.rspec_opts = '-f documentation -w'
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
RuboCop::RakeTask.new
|
|
30
|
+
|
|
31
|
+
# Clean up afterwards
|
|
32
|
+
Rake::Task[:spec].enhance do
|
|
33
|
+
Rake::Task[:clean].invoke
|
|
34
|
+
end
|
|
35
|
+
|
|
27
36
|
task :default => :spec
|
data/apple-system-logger.gemspec
CHANGED
|
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |spec|
|
|
4
4
|
spec.name = 'apple-system-logger'
|
|
5
|
-
spec.version = '0.1.
|
|
5
|
+
spec.version = '0.1.3'
|
|
6
6
|
spec.author = 'Daniel J. Berger'
|
|
7
7
|
spec.email = 'djberg96@gmail.com'
|
|
8
8
|
spec.license = 'Apache-2.0'
|
|
@@ -12,17 +12,20 @@ Gem::Specification.new do |spec|
|
|
|
12
12
|
spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
|
13
13
|
spec.cert_chain = ['certs/djberg96_pub.pem']
|
|
14
14
|
|
|
15
|
-
spec.add_dependency('ffi')
|
|
15
|
+
spec.add_dependency('ffi', '~> 1.1')
|
|
16
16
|
spec.add_development_dependency('rake')
|
|
17
|
-
spec.add_development_dependency('rspec')
|
|
17
|
+
spec.add_development_dependency('rspec', '~> 3.9')
|
|
18
|
+
spec.add_development_dependency('rubocop')
|
|
19
|
+
spec.add_development_dependency('rubocop-rspec')
|
|
18
20
|
|
|
19
21
|
spec.metadata = {
|
|
20
|
-
'homepage_uri'
|
|
21
|
-
'bug_tracker_uri'
|
|
22
|
-
'changelog_uri'
|
|
23
|
-
'documentation_uri'
|
|
24
|
-
'source_code_uri'
|
|
25
|
-
'wiki_uri'
|
|
22
|
+
'homepage_uri' => 'https://github.com/djberg96/apple-system-logger',
|
|
23
|
+
'bug_tracker_uri' => 'https://github.com/djberg96/apple-system-logger/issues',
|
|
24
|
+
'changelog_uri' => 'https://github.com/djberg96/apple-system-logger/blob/main/CHANGES.md',
|
|
25
|
+
'documentation_uri' => 'https://github.com/djberg96/apple-system-logger/wiki',
|
|
26
|
+
'source_code_uri' => 'https://github.com/djberg96/apple-system-logger',
|
|
27
|
+
'wiki_uri' => 'https://github.com/djberg96/apple-system-logger/wiki',
|
|
28
|
+
'rubygems_mfa_required' => 'true'
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
spec.description = <<-EOF
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Apple
|
|
2
4
|
module System
|
|
3
5
|
module LoggerConstants
|
|
4
|
-
ASL_KEY_TIME =
|
|
5
|
-
ASL_KEY_HOST =
|
|
6
|
-
ASL_KEY_SENDER =
|
|
7
|
-
ASL_KEY_FACILITY =
|
|
8
|
-
ASL_KEY_PID =
|
|
9
|
-
ASL_KEY_UID =
|
|
10
|
-
ASL_KEY_GID =
|
|
11
|
-
ASL_KEY_LEVEL =
|
|
12
|
-
ASL_KEY_MSG =
|
|
6
|
+
ASL_KEY_TIME = 'Time'
|
|
7
|
+
ASL_KEY_HOST = 'Host'
|
|
8
|
+
ASL_KEY_SENDER = 'Sender'
|
|
9
|
+
ASL_KEY_FACILITY = 'Facility'
|
|
10
|
+
ASL_KEY_PID = 'PID'
|
|
11
|
+
ASL_KEY_UID = 'UID'
|
|
12
|
+
ASL_KEY_GID = 'GID'
|
|
13
|
+
ASL_KEY_LEVEL = 'Level'
|
|
14
|
+
ASL_KEY_MSG = 'Message'
|
|
13
15
|
|
|
14
16
|
ASL_LEVEL_EMERG = 0
|
|
15
17
|
ASL_LEVEL_ALERT = 1
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'ffi'
|
|
2
4
|
|
|
3
5
|
module Apple
|
|
@@ -6,22 +8,22 @@ module Apple
|
|
|
6
8
|
extend FFI::Library
|
|
7
9
|
ffi_lib FFI::Library::LIBC
|
|
8
10
|
|
|
9
|
-
attach_function(:asl_add_log_file, [
|
|
11
|
+
attach_function(:asl_add_log_file, %i[pointer int], :int)
|
|
10
12
|
attach_function(:asl_close, [:pointer], :void)
|
|
11
13
|
attach_function(:asl_free, [:pointer], :void)
|
|
12
|
-
attach_function(:asl_get, [
|
|
13
|
-
attach_function(:asl_key, [
|
|
14
|
-
attach_function(:asl_log, [
|
|
14
|
+
attach_function(:asl_get, %i[pointer string], :string)
|
|
15
|
+
attach_function(:asl_key, %i[pointer uint32], :string)
|
|
16
|
+
attach_function(:asl_log, %i[pointer pointer int string varargs], :int)
|
|
15
17
|
attach_function(:asl_new, [:uint32], :pointer)
|
|
16
|
-
attach_function(:asl_open, [
|
|
17
|
-
attach_function(:asl_remove_log_file, [
|
|
18
|
-
attach_function(:asl_search, [
|
|
19
|
-
attach_function(:asl_send, [
|
|
20
|
-
attach_function(:asl_set, [
|
|
21
|
-
attach_function(:asl_set_filter, [
|
|
22
|
-
attach_function(:asl_set_query, [
|
|
23
|
-
attach_function(:asl_unset, [
|
|
24
|
-
attach_function(:asl_vlog, [
|
|
18
|
+
attach_function(:asl_open, %i[string string uint32], :pointer)
|
|
19
|
+
attach_function(:asl_remove_log_file, %i[pointer int], :int)
|
|
20
|
+
attach_function(:asl_search, %i[pointer pointer], :pointer)
|
|
21
|
+
attach_function(:asl_send, %i[pointer pointer], :int)
|
|
22
|
+
attach_function(:asl_set, %i[pointer string string], :int)
|
|
23
|
+
attach_function(:asl_set_filter, %i[pointer int], :int)
|
|
24
|
+
attach_function(:asl_set_query, %i[pointer string string uint32], :int)
|
|
25
|
+
attach_function(:asl_unset, %i[pointer string], :int)
|
|
26
|
+
attach_function(:asl_vlog, %i[pointer pointer int string pointer], :int)
|
|
25
27
|
attach_function(:aslresponse_free, [:pointer], :void)
|
|
26
28
|
attach_function(:aslresponse_next, [:pointer], :pointer)
|
|
27
29
|
end
|
data/lib/apple/system/logger.rb
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require_relative 'logger/functions'
|
|
2
4
|
require_relative 'logger/constants'
|
|
3
5
|
|
|
6
|
+
# The Apple module serves as a namespace only.
|
|
4
7
|
module Apple
|
|
8
|
+
# The System module serves only as a namespace.
|
|
5
9
|
module System
|
|
10
|
+
# The Logger class encapsulates the logging functions of the OSX logging API.
|
|
6
11
|
class Logger
|
|
7
12
|
include Apple::System::LoggerFunctions
|
|
8
13
|
include Apple::System::LoggerConstants
|
|
9
14
|
|
|
10
15
|
# The version of this library.
|
|
11
|
-
VERSION = '0.1.
|
|
16
|
+
VERSION = '0.1.3'
|
|
12
17
|
|
|
13
18
|
# A syslogd facility. The system default is 'user'.
|
|
14
19
|
attr_reader :facility
|
|
@@ -29,8 +34,10 @@ module Apple
|
|
|
29
34
|
# * level
|
|
30
35
|
# * progname
|
|
31
36
|
# * logdev
|
|
37
|
+
# * stderr
|
|
32
38
|
#
|
|
33
39
|
# Note that the logdev only seems to work with $stdout or $stderr, if provided.
|
|
40
|
+
# You can also specify ':stderr => true' to automatically multicast to stderr.
|
|
34
41
|
#
|
|
35
42
|
# For the severity level, the possible values are:
|
|
36
43
|
#
|
|
@@ -51,6 +58,7 @@ module Apple
|
|
|
51
58
|
# # Typical
|
|
52
59
|
# log = Apple::System::Logger.new(facility: 'com.apple.console', progname: 'my-program')
|
|
53
60
|
# log.warn("Some warning message")
|
|
61
|
+
# log.close
|
|
54
62
|
#
|
|
55
63
|
# # Block form
|
|
56
64
|
# Apple::System::Logger.new(facility: 'com.apple.console', progname: 'my-program') do |log|
|
|
@@ -64,17 +72,14 @@ module Apple
|
|
|
64
72
|
@level = kwargs[:level] || ASL_LEVEL_DEBUG
|
|
65
73
|
@progname = kwargs[:progname]
|
|
66
74
|
@logdev = kwargs[:logdev]
|
|
75
|
+
@stderr = kwargs[:stderr]
|
|
67
76
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
@aslclient = asl_open(@progname, @facility, options)
|
|
77
|
+
options = ASL_OPT_NO_DELAY | ASL_OPT_NO_REMOTE
|
|
78
|
+
options |= ASL_OPT_STDERR if @stderr
|
|
71
79
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
else
|
|
76
|
-
@aslclient = nil
|
|
77
|
-
end
|
|
80
|
+
@aslclient = asl_open(@progname, @facility, options)
|
|
81
|
+
|
|
82
|
+
asl_add_log_file(@aslclient, @logdev.fileno) if @logdev
|
|
78
83
|
|
|
79
84
|
@aslmsg = asl_new(ASL_TYPE_MSG)
|
|
80
85
|
asl_set(@aslmsg, ASL_KEY_FACILITY, @facility) if @facility
|
|
@@ -139,11 +144,11 @@ module Apple
|
|
|
139
144
|
|
|
140
145
|
# Log an error message.
|
|
141
146
|
#
|
|
142
|
-
def error
|
|
147
|
+
def error(message)
|
|
143
148
|
asl_log(@aslclient, @aslmsg, ASL_LEVEL_ERR, message)
|
|
144
149
|
end
|
|
145
150
|
|
|
146
|
-
# Returns true if the current severity level allows for the printing of
|
|
151
|
+
# Returns true if the current severity level allows for the printing of error messages.
|
|
147
152
|
#
|
|
148
153
|
def error?
|
|
149
154
|
level >= ASL_LEVEL_ERR
|
|
@@ -151,7 +156,7 @@ module Apple
|
|
|
151
156
|
|
|
152
157
|
# Log a fatal message. For this library that means an ASL_LEVEL_CRIT message.
|
|
153
158
|
#
|
|
154
|
-
def fatal
|
|
159
|
+
def fatal(message)
|
|
155
160
|
asl_log(@aslclient, @aslmsg, ASL_LEVEL_CRIT, message)
|
|
156
161
|
end
|
|
157
162
|
|
|
@@ -209,18 +214,21 @@ module Apple
|
|
|
209
214
|
#
|
|
210
215
|
# Note that Time objects are queried using "greater than or equal to" for now.
|
|
211
216
|
#
|
|
217
|
+
# You can use a regular expression as a value, though special options are
|
|
218
|
+
# limited to 'i' (case insensitive).
|
|
219
|
+
#
|
|
212
220
|
# Example:
|
|
213
221
|
#
|
|
214
222
|
# # Find all logs from uid 501 from the last hour.
|
|
215
223
|
# log.search(:uid => 501, :time => Time.now - 3600)
|
|
216
224
|
#
|
|
217
225
|
def search(query)
|
|
218
|
-
value = nil
|
|
219
226
|
aslmsg = asl_new(ASL_TYPE_QUERY)
|
|
220
227
|
result = []
|
|
221
228
|
|
|
222
229
|
query.each do |key, value|
|
|
223
230
|
asl_key = map_key_to_asl_key(key)
|
|
231
|
+
|
|
224
232
|
flags = ASL_QUERY_OP_EQUAL
|
|
225
233
|
flags = (flags | ASL_QUERY_OP_NUMERIC) if value.is_a?(Numeric)
|
|
226
234
|
flags = (flags | ASL_QUERY_OP_TRUE) if value == true
|
|
@@ -272,16 +280,16 @@ module Apple
|
|
|
272
280
|
|
|
273
281
|
def map_key_to_asl_key(key)
|
|
274
282
|
{
|
|
275
|
-
:time
|
|
276
|
-
:host
|
|
277
|
-
:sender
|
|
283
|
+
:time => ASL_KEY_TIME,
|
|
284
|
+
:host => ASL_KEY_HOST,
|
|
285
|
+
:sender => ASL_KEY_SENDER,
|
|
278
286
|
:facility => ASL_KEY_FACILITY,
|
|
279
|
-
:pid
|
|
280
|
-
:uid
|
|
281
|
-
:gid
|
|
282
|
-
:level
|
|
283
|
-
:message
|
|
284
|
-
}
|
|
287
|
+
:pid => ASL_KEY_PID,
|
|
288
|
+
:uid => ASL_KEY_UID,
|
|
289
|
+
:gid => ASL_KEY_GID,
|
|
290
|
+
:level => ASL_KEY_LEVEL,
|
|
291
|
+
:message => ASL_KEY_MSG
|
|
292
|
+
}.fetch(key)
|
|
285
293
|
end
|
|
286
294
|
end
|
|
287
295
|
end
|
data/lib/apple-system-logger.rb
CHANGED
|
@@ -1,125 +1,131 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'apple-system-logger'
|
|
2
4
|
|
|
3
5
|
RSpec.describe Apple::System::Logger do
|
|
4
6
|
let(:log){ described_class.new }
|
|
5
7
|
|
|
6
|
-
context
|
|
7
|
-
example
|
|
8
|
-
expect(described_class::VERSION).to eql('0.1.
|
|
8
|
+
context 'version' do
|
|
9
|
+
example 'version constant is set to expected value' do
|
|
10
|
+
expect(described_class::VERSION).to eql('0.1.3')
|
|
9
11
|
end
|
|
10
12
|
|
|
11
|
-
example
|
|
13
|
+
example 'version constant is frozen' do
|
|
12
14
|
expect(described_class::VERSION).to be_frozen
|
|
13
15
|
end
|
|
14
16
|
end
|
|
15
17
|
|
|
16
|
-
context
|
|
17
|
-
example
|
|
18
|
+
context 'instance methods' do
|
|
19
|
+
example 'defines a facility method' do
|
|
18
20
|
expect(log).to respond_to(:facility)
|
|
19
21
|
end
|
|
20
22
|
|
|
21
|
-
example
|
|
23
|
+
example 'the default facility is nil' do
|
|
22
24
|
expect(log.facility).to be_nil
|
|
23
25
|
end
|
|
24
26
|
|
|
25
|
-
example
|
|
27
|
+
example 'defines a level method' do
|
|
26
28
|
expect(log).to respond_to(:level)
|
|
27
29
|
end
|
|
28
30
|
|
|
29
|
-
example
|
|
31
|
+
example 'the default level is debug' do
|
|
30
32
|
expect(log.level).to eql(Apple::System::Logger::ASL_LEVEL_DEBUG)
|
|
31
33
|
end
|
|
32
34
|
|
|
33
|
-
example
|
|
35
|
+
example 'defines a progname method' do
|
|
34
36
|
expect(log).to respond_to(:progname)
|
|
35
37
|
end
|
|
36
38
|
|
|
37
|
-
example
|
|
39
|
+
example 'the default progname is nil' do
|
|
38
40
|
expect(log.progname).to be_nil
|
|
39
41
|
end
|
|
40
42
|
|
|
41
|
-
example
|
|
43
|
+
example 'defines a logdev method' do
|
|
42
44
|
expect(log).to respond_to(:logdev)
|
|
43
45
|
end
|
|
44
46
|
|
|
45
|
-
example
|
|
47
|
+
example 'the default logdev is nil' do
|
|
46
48
|
expect(log.logdev).to be_nil
|
|
47
49
|
end
|
|
48
50
|
end
|
|
49
51
|
|
|
50
|
-
context
|
|
51
|
-
example
|
|
52
|
+
context 'logging methods' do
|
|
53
|
+
example 'there is a << method' do
|
|
52
54
|
expect(log).to respond_to(:<<)
|
|
53
55
|
end
|
|
54
56
|
|
|
55
|
-
example
|
|
57
|
+
example 'there is an add method' do
|
|
56
58
|
expect(log).to respond_to(:add)
|
|
57
59
|
end
|
|
58
60
|
|
|
59
|
-
example
|
|
61
|
+
example 'there is a debug method' do
|
|
60
62
|
expect(log).to respond_to(:debug)
|
|
61
63
|
end
|
|
62
64
|
|
|
63
|
-
example
|
|
65
|
+
example 'there is a debug? method that returns the expected value' do
|
|
64
66
|
expect(log.debug?).to be true
|
|
65
67
|
end
|
|
66
68
|
|
|
67
|
-
example
|
|
69
|
+
example 'there is an info method' do
|
|
68
70
|
expect(log).to respond_to(:info)
|
|
69
71
|
end
|
|
70
72
|
|
|
71
|
-
example
|
|
73
|
+
example 'there is a info? method that returns the expected value' do
|
|
72
74
|
expect(log.info?).to be true
|
|
73
75
|
end
|
|
74
76
|
|
|
75
|
-
example
|
|
77
|
+
example 'there is a warn method' do
|
|
76
78
|
expect(log).to respond_to(:warn)
|
|
77
79
|
end
|
|
78
80
|
|
|
79
|
-
example
|
|
81
|
+
example 'there is a warn? method that returns the expected value' do
|
|
80
82
|
expect(log.warn?).to be true
|
|
81
83
|
end
|
|
82
84
|
|
|
83
|
-
example
|
|
85
|
+
example 'there is an error method' do
|
|
84
86
|
expect(log).to respond_to(:error)
|
|
85
87
|
end
|
|
86
88
|
|
|
87
|
-
example
|
|
89
|
+
example 'there is a error? method that returns the expected value' do
|
|
88
90
|
expect(log.error?).to be true
|
|
89
91
|
end
|
|
90
92
|
|
|
91
|
-
example
|
|
92
|
-
expect(log).to respond_to(:
|
|
93
|
+
example 'there is a fatal method' do
|
|
94
|
+
expect(log).to respond_to(:fatal)
|
|
93
95
|
end
|
|
94
96
|
|
|
95
|
-
example
|
|
97
|
+
example 'there is a fatal? method that returns the expected value' do
|
|
96
98
|
expect(log.fatal?).to be true
|
|
97
99
|
end
|
|
98
100
|
|
|
99
|
-
example
|
|
101
|
+
example 'there is an unknown method' do
|
|
100
102
|
expect(log).to respond_to(:unknown)
|
|
101
103
|
end
|
|
102
104
|
|
|
103
|
-
example
|
|
105
|
+
example 'there is a close method' do
|
|
104
106
|
expect(log).to respond_to(:close)
|
|
105
107
|
end
|
|
106
108
|
|
|
107
|
-
example
|
|
109
|
+
example 'calling close on the logger instance works as expected' do
|
|
108
110
|
expect(log.close).to be_nil
|
|
109
111
|
expect(log.close).to be_nil
|
|
110
112
|
end
|
|
111
113
|
end
|
|
112
114
|
|
|
113
|
-
context
|
|
114
|
-
example
|
|
115
|
+
context 'search' do
|
|
116
|
+
example 'there is a search method' do
|
|
115
117
|
expect(log).to respond_to(:search)
|
|
116
118
|
end
|
|
117
119
|
|
|
118
|
-
example
|
|
120
|
+
example 'a basic search returns the expected results' do
|
|
119
121
|
result = log.search(:sender => 'bootlog', :level => 5)
|
|
120
|
-
expect(result).to
|
|
121
|
-
expect(result.first).to
|
|
122
|
+
expect(result).to be_a(Array)
|
|
123
|
+
expect(result.first).to be_a(Hash)
|
|
122
124
|
expect(result.size).to be >= 1
|
|
123
125
|
end
|
|
126
|
+
|
|
127
|
+
example 'search keys must be valid' do
|
|
128
|
+
expect{ log.search(:bogus => 'bootlog') }.to raise_error(KeyError)
|
|
129
|
+
end
|
|
124
130
|
end
|
|
125
131
|
end
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: apple-system-logger
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel J. Berger
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain:
|
|
11
10
|
- |
|
|
@@ -35,16 +34,30 @@ cert_chain:
|
|
|
35
34
|
ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
|
|
36
35
|
WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
|
|
37
36
|
-----END CERTIFICATE-----
|
|
38
|
-
date:
|
|
37
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
39
38
|
dependencies:
|
|
40
39
|
- !ruby/object:Gem::Dependency
|
|
41
40
|
name: ffi
|
|
41
|
+
requirement: !ruby/object:Gem::Requirement
|
|
42
|
+
requirements:
|
|
43
|
+
- - "~>"
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: '1.1'
|
|
46
|
+
type: :runtime
|
|
47
|
+
prerelease: false
|
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
49
|
+
requirements:
|
|
50
|
+
- - "~>"
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: '1.1'
|
|
53
|
+
- !ruby/object:Gem::Dependency
|
|
54
|
+
name: rake
|
|
42
55
|
requirement: !ruby/object:Gem::Requirement
|
|
43
56
|
requirements:
|
|
44
57
|
- - ">="
|
|
45
58
|
- !ruby/object:Gem::Version
|
|
46
59
|
version: '0'
|
|
47
|
-
type: :
|
|
60
|
+
type: :development
|
|
48
61
|
prerelease: false
|
|
49
62
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
63
|
requirements:
|
|
@@ -52,7 +65,21 @@ dependencies:
|
|
|
52
65
|
- !ruby/object:Gem::Version
|
|
53
66
|
version: '0'
|
|
54
67
|
- !ruby/object:Gem::Dependency
|
|
55
|
-
name:
|
|
68
|
+
name: rspec
|
|
69
|
+
requirement: !ruby/object:Gem::Requirement
|
|
70
|
+
requirements:
|
|
71
|
+
- - "~>"
|
|
72
|
+
- !ruby/object:Gem::Version
|
|
73
|
+
version: '3.9'
|
|
74
|
+
type: :development
|
|
75
|
+
prerelease: false
|
|
76
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
77
|
+
requirements:
|
|
78
|
+
- - "~>"
|
|
79
|
+
- !ruby/object:Gem::Version
|
|
80
|
+
version: '3.9'
|
|
81
|
+
- !ruby/object:Gem::Dependency
|
|
82
|
+
name: rubocop
|
|
56
83
|
requirement: !ruby/object:Gem::Requirement
|
|
57
84
|
requirements:
|
|
58
85
|
- - ">="
|
|
@@ -66,7 +93,7 @@ dependencies:
|
|
|
66
93
|
- !ruby/object:Gem::Version
|
|
67
94
|
version: '0'
|
|
68
95
|
- !ruby/object:Gem::Dependency
|
|
69
|
-
name: rspec
|
|
96
|
+
name: rubocop-rspec
|
|
70
97
|
requirement: !ruby/object:Gem::Requirement
|
|
71
98
|
requirements:
|
|
72
99
|
- - ">="
|
|
@@ -88,35 +115,30 @@ executables: []
|
|
|
88
115
|
extensions: []
|
|
89
116
|
extra_rdoc_files: []
|
|
90
117
|
files:
|
|
118
|
+
- CHANGES.md
|
|
119
|
+
- Gemfile
|
|
91
120
|
- LICENSE
|
|
92
|
-
-
|
|
93
|
-
- spec
|
|
94
|
-
- spec/apple-system-logger_spec.rb
|
|
121
|
+
- MANIFEST.md
|
|
95
122
|
- README.md
|
|
96
123
|
- Rakefile
|
|
97
|
-
-
|
|
98
|
-
- certs
|
|
124
|
+
- apple-system-logger.gemspec
|
|
99
125
|
- certs/djberg96_pub.pem
|
|
100
|
-
- lib
|
|
101
|
-
- lib/apple
|
|
102
|
-
- lib/apple/system
|
|
103
|
-
- lib/apple/system/logger
|
|
126
|
+
- lib/apple-system-logger.rb
|
|
127
|
+
- lib/apple/system/logger.rb
|
|
104
128
|
- lib/apple/system/logger/constants.rb
|
|
105
129
|
- lib/apple/system/logger/functions.rb
|
|
106
|
-
-
|
|
107
|
-
- lib/apple-system-logger.rb
|
|
108
|
-
- CHANGES.md
|
|
130
|
+
- spec/apple-system-logger_spec.rb
|
|
109
131
|
homepage: https://github.com/djberg96/apple-system-logger
|
|
110
132
|
licenses:
|
|
111
133
|
- Apache-2.0
|
|
112
134
|
metadata:
|
|
113
135
|
homepage_uri: https://github.com/djberg96/apple-system-logger
|
|
114
136
|
bug_tracker_uri: https://github.com/djberg96/apple-system-logger/issues
|
|
115
|
-
changelog_uri: https://github.com/djberg96/apple-system-logger/blob/
|
|
137
|
+
changelog_uri: https://github.com/djberg96/apple-system-logger/blob/main/CHANGES.md
|
|
116
138
|
documentation_uri: https://github.com/djberg96/apple-system-logger/wiki
|
|
117
139
|
source_code_uri: https://github.com/djberg96/apple-system-logger
|
|
118
140
|
wiki_uri: https://github.com/djberg96/apple-system-logger/wiki
|
|
119
|
-
|
|
141
|
+
rubygems_mfa_required: 'true'
|
|
120
142
|
rdoc_options: []
|
|
121
143
|
require_paths:
|
|
122
144
|
- lib
|
|
@@ -131,8 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
131
153
|
- !ruby/object:Gem::Version
|
|
132
154
|
version: '0'
|
|
133
155
|
requirements: []
|
|
134
|
-
rubygems_version: 3.
|
|
135
|
-
signing_key:
|
|
156
|
+
rubygems_version: 3.7.2
|
|
136
157
|
specification_version: 4
|
|
137
158
|
summary: A Ruby interface for the Apple System Logger
|
|
138
159
|
test_files:
|
metadata.gz.sig
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
tV=z�9�J@F[T���_˘Ѽ�gp������vw�;$Zaz���d
|
|
1
|
+
B�B�"Kd5&�|[��y���m5n�G�R�c��R&.|��g��E���|U�K�ɄJa�)��a�~�D--����om������A���I2��P���uyGI���O��4�$sy�1��N=�����I&�$z�KO������!l�a��첵�(f��!I����=t�C�8d]˅Pܭ�Nd,cF7R5]>���ޜ?��A�/��L
|
|
2
|
+
`g
|