journald-native 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40cc80f310e9a40ca958130fae646a2498d50876
4
- data.tar.gz: 742cc24381ddf5eaddba2baf430ef332f6030a2e
3
+ metadata.gz: bd487e7cc5f8f4afd839c141cda94ba78a2109cc
4
+ data.tar.gz: e7b5952a046140f8d0e0141446342b658de604c5
5
5
  SHA512:
6
- metadata.gz: 6a0254aae671f1b71835ccb8ae0a22fed7827ad195643f1192dc930587b2c906723ecc2254d9c7fb59229a39ba8566b5039dbe1c04a6349e34170ec602109936
7
- data.tar.gz: 3eaf04c61e3a201c86a430c03abed4da16ec7daccfc9c6d90e9b0c22ce1fbee34ba3c2d3d4758f4f23762eeaa93b6fb0d21b4e655f8fe7b11f289569c36b8b81
6
+ metadata.gz: 93f5494817ce979b29d2ce630dd4a35675ab685137b61d8556fbb58c816e0d5978c48d4df8c64323baba2fc0feae783af9720790d7565230eea9c58995287f27
7
+ data.tar.gz: 0a3e5b415e8b0491c7bad759d7d99767022e6c4c212923b3083b08a41e636bc6aa221c552d3334081b8db79a02ae6539e425fef31d9431458eb3ded4e4d6dd9e
data/.gitignore CHANGED
@@ -26,3 +26,4 @@ Makefile
26
26
  *.iws
27
27
  .rakeTasks
28
28
  .idea
29
+ extconf.h
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # journald-native
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/journald-native.svg)](http://badge.fury.io/rb/journald-native)
4
+ [![Reference Status](https://www.versioneye.com/ruby/journald-native/reference_badge.svg)](https://www.versioneye.com/ruby/journald-native/references)
4
5
 
5
6
  A systemd-journal native logging lib wrapper.
6
7
  [See sd-journal help for more info](http://www.freedesktop.org/software/systemd/man/sd_journal_print.html)
@@ -9,12 +9,28 @@ LIB_DIRS = [LIBDIR]
9
9
 
10
10
  dir_config('systemd', HEADER_DIRS, LIB_DIRS)
11
11
 
12
+ def have_funcs
13
+ have_funcs = true
14
+
15
+ # check functions. redefine const list in sd_journal.h if changed
16
+ %w(sd_journal_print sd_journal_sendv sd_journal_perror).each do |func|
17
+ have_funcs &&= have_func(func)
18
+ end
19
+
20
+ have_funcs
21
+ end
22
+
12
23
  # check headers
13
- abort 'systemd/sd-journal.h is missing. please install systemd-journal' unless find_header('systemd/sd-journal.h')
24
+ have_header('systemd/sd-journal.h')
25
+
26
+ # first try to find funcs in systemd
27
+ have_library('systemd')
14
28
 
15
- # check functions
16
- %w(sd_journal_print sd_journal_sendv sd_journal_perror).each do |func|
17
- abort "#{func}() is missing. systemd-journal is not usable" unless find_library('systemd-journal', func)
29
+ unless have_funcs
30
+ have_library('systemd-journal') # try to fall back to systemd-journal if older systemd
31
+ have_funcs
18
32
  end
19
33
 
34
+ create_header
20
35
  create_makefile('journald_native')
36
+
@@ -2,7 +2,7 @@
2
2
  #define SD_JOURNAL_SUPPRESS_LOCATION
3
3
 
4
4
  #include <ruby.h>
5
- #include <systemd/sd-journal.h>
5
+ #include "sd_journal.h"
6
6
 
7
7
  void Init_journald_native();
8
8
 
@@ -73,7 +73,7 @@ static VALUE jdl_native_print(VALUE v_self, VALUE v_priority, VALUE v_message)
73
73
  static VALUE jdl_native_send(int argc, VALUE* argv, VALUE self)
74
74
  {
75
75
  struct iovec *msgs;
76
- size_t i;
76
+ int i;
77
77
  int result;
78
78
 
79
79
  /* first check everything is a string / convertable to string */
@@ -0,0 +1,71 @@
1
+ #ifdef __cplusplus
2
+ extern "C" {
3
+ #endif
4
+
5
+ #ifndef JOURNALD_NATIVE_SD_JOURNAL_H
6
+ #define JOURNALD_NATIVE_SD_JOURNAL_H
7
+
8
+ #ifdef __linux__
9
+
10
+ /* do the real stuff */
11
+
12
+ #include "extconf.h"
13
+
14
+ /* check for extconf results */
15
+
16
+ #ifndef HAVE_SYSTEMD_SD_JOURNAL_H
17
+ #error Cannot include <systemd/sd-journal.h>. Please use linux version with systemd-journal installed
18
+ #endif
19
+
20
+ #ifndef HAVE_SD_JOURNAL_PRINT
21
+ #error Required function sd_journal_print is missing
22
+ #endif
23
+
24
+ #ifndef HAVE_SD_JOURNAL_SENDV
25
+ #error Required function sd_journal_sendv is missing
26
+ #endif
27
+
28
+ #ifndef HAVE_SD_JOURNAL_PERROR
29
+ #error Required function sd_journal_perror is missing
30
+ #endif
31
+
32
+ /* include systemd-journal headers */
33
+
34
+ #include <systemd/sd-journal.h>
35
+
36
+ #else
37
+
38
+ #warning Compiling dummy version of the gem for non-Linux OS
39
+
40
+ #include <stdlib.h>
41
+
42
+ /* use dummy */
43
+ #define JOURNALD_NATIVE_SYSTEMD_JOURNAL_DUMMY
44
+
45
+ /* syslog constants */
46
+ #define LOG_EMERG 0
47
+ #define LOG_ALERT 1
48
+ #define LOG_CRIT 2
49
+ #define LOG_ERR 3
50
+ #define LOG_WARNING 4
51
+ #define LOG_NOTICE 5
52
+ #define LOG_INFO 6
53
+ #define LOG_DEBUG 7
54
+
55
+ /* iovec */
56
+ struct iovec {
57
+ void *iov_base; /* Starting address */
58
+ size_t iov_len; /* Number of bytes to transfer */
59
+ };
60
+
61
+ int sd_journal_print(int priority, const char *format, ...);
62
+ int sd_journal_sendv(const struct iovec *iov, int n);
63
+ int sd_journal_perror(const char *message);
64
+
65
+ #endif
66
+
67
+ #endif
68
+
69
+ #ifdef __cplusplus
70
+ }
71
+ #endif
@@ -0,0 +1,9 @@
1
+ #include "sd_journal.h"
2
+
3
+ #ifdef JOURNALD_NATIVE_SYSTEMD_JOURNAL_DUMMY
4
+
5
+ int sd_journal_print(int priority, const char *format, ...) { return 0; }
6
+ int sd_journal_sendv(const struct iovec *iov, int n) { return 0; }
7
+ int sd_journal_perror(const char *message) { return 0; }
8
+
9
+ #endif
@@ -1,5 +1,5 @@
1
1
  module Journald
2
2
  module Native
3
- VERSION = '1.0.2'
3
+ VERSION = '1.0.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: journald-native
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Smirnov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-31 00:00:00.000000000 Z
11
+ date: 2015-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.6'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.6'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake-compiler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  description:
@@ -60,13 +60,15 @@ extensions:
60
60
  - ext/journald_native/extconf.rb
61
61
  extra_rdoc_files: []
62
62
  files:
63
- - .gitignore
63
+ - ".gitignore"
64
64
  - Gemfile
65
65
  - LICENSE.txt
66
66
  - README.md
67
67
  - Rakefile
68
68
  - ext/journald_native/extconf.rb
69
69
  - ext/journald_native/journald_native.c
70
+ - ext/journald_native/sd_journal.h
71
+ - ext/journald_native/sd_journal_dummy.c
70
72
  - journald-native.gemspec
71
73
  - lib/journald/native.rb
72
74
  - lib/journald/native/version.rb
@@ -80,19 +82,18 @@ require_paths:
80
82
  - lib
81
83
  required_ruby_version: !ruby/object:Gem::Requirement
82
84
  requirements:
83
- - - '>='
85
+ - - ">="
84
86
  - !ruby/object:Gem::Version
85
87
  version: 1.9.2
86
88
  required_rubygems_version: !ruby/object:Gem::Requirement
87
89
  requirements:
88
- - - '>='
90
+ - - ">="
89
91
  - !ruby/object:Gem::Version
90
92
  version: '0'
91
93
  requirements: []
92
94
  rubyforge_project:
93
- rubygems_version: 2.1.11
95
+ rubygems_version: 2.4.3
94
96
  signing_key:
95
97
  specification_version: 4
96
98
  summary: systemd-journal logging native lib wrapper
97
99
  test_files: []
98
- has_rdoc: