GunnyLog 1.0.7 → 1.0.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ae15d7b7a1cd1e0f1c5708bfe22445b79e01e4f3
4
- data.tar.gz: 3ed29da80bb39777b6b243af6f191b5a00a3567c
3
+ metadata.gz: 30733cb2970e211ec7511c2a7f5ccc4fff19a934
4
+ data.tar.gz: 83e967d12adcefe8b87ba9ffb75eea0d114ae5d6
5
5
  SHA512:
6
- metadata.gz: e999c83d931d129e626a1678628bfcb669870cf06a2f48ac6ade949053f19e529d39ad54326a68ce4422911b7f58787029eda2927374fba5d534a91aff96142f
7
- data.tar.gz: b061e89263b61666601071ee55d2d19518ce76aa1a3924acf69cbcd09743347715ca0b196f8e1c15f06f4dd1dd482493589d2d0cf99c232aff0abeb746cbd829
6
+ metadata.gz: 3533e7fe106b06a6bb027986a1afe0e90a735418bfde6e5d677b000b22217504ee2f0c14f27462b5a0ae1676786e56587efc1ac8826b25d23215b740c1b2000a
7
+ data.tar.gz: 6e1f4bdf2932551756b1d20f3477d9f8f6f4d6dc4f88896fec961e49f00e662c1b84255eeda46c1ae100b84d599927a731ac94eafc50d951aef70daa81bb01ff
@@ -6,13 +6,10 @@ require 'date'
6
6
 
7
7
 
8
8
  # GunnyLog logs messages to stdout(default), stderr, or a file
9
+ # GunnyLog is a singleton and uses the instance method. Examples:
10
+ # log = GunnyLog.instance or GunnyLog.instance.msg('Error message')
9
11
  class GunnyLog
10
12
 
11
- # Singleton instance method
12
- #def self.instance
13
- # @@instance ||= new
14
- #end
15
-
16
13
  # Set logging on and off
17
14
  # @param flag [bool] switch for on or off
18
15
  def set_logging_enabled(flag)
@@ -63,9 +60,6 @@ class GunnyLog
63
60
  @_is_file_open = true
64
61
  rescue SystemCallError
65
62
  raise GunnyLogException.new('Error opening file: ' + filename)
66
- #STDERR.puts 'GunnyLog: Error opening file: ' + filename + ' using stdout'
67
- #@_is_file_open = false
68
- #@logging_file = STDOUT
69
63
  end
70
64
  end
71
65
 
@@ -76,15 +70,6 @@ class GunnyLog
76
70
  def open_with_info(pathname = nil,
77
71
  filename = 'gunnylog',
78
72
  extension = 'log')
79
-
80
- #if pathname == nil
81
- # puts 'pathname = nil'
82
- #else
83
- # puts 'pathname = ' + pathname
84
- #end
85
- #puts 'filename = ' + filename
86
- #puts 'extension = ' + extension
87
-
88
73
  if pathname == nil
89
74
  self.open(filename + '.' + extension)
90
75
  else
@@ -96,12 +81,11 @@ class GunnyLog
96
81
  def close
97
82
  begin
98
83
  @logging_file.close
84
+ @_is_file_open = false
85
+ @logging_file = STDOUT
99
86
  rescue SystemCallError
100
87
  raise GunnyLogException.new('Error closing file')
101
- #STDERR.puts 'GunnyLog: Error closing file'
102
88
  end
103
- @_is_file_open = false
104
- @logging_file = STDOUT
105
89
  end
106
90
 
107
91
  # Write message to file
@@ -114,11 +98,7 @@ class GunnyLog
114
98
  # @param loc [string] message message_location, optional
115
99
  # @param msg [string] message string
116
100
  def message(loc = nil, msg)
117
- #if @_is_file_open
118
101
  write_msg(@logging_file, loc, msg)
119
- #else
120
- # write_msg(STDOUT, loc, msg)
121
- #end
122
102
  end
123
103
 
124
104
  # Write formatted message with single arg or array of args
@@ -176,7 +156,6 @@ class GunnyLog
176
156
  if loc == nil
177
157
  loc = @message_location
178
158
  else
179
- # new, not sure
180
159
  @message_location = loc
181
160
  end
182
161
  if @_is_logging_enabled
@@ -189,7 +168,7 @@ class GunnyLog
189
168
  d = DateTime.now
190
169
  d.strftime('%m/%d/%Y|%I:%M:%S%p')
191
170
  end
192
-
171
+
193
172
  end
194
173
 
195
174
 
@@ -1,4 +1,3 @@
1
1
  class GunnyLog
2
- VERSION = '1.0.7'
3
- #DESC_VERSION = 'GunnyLog Version: ' + GunnyLog::VERSION
2
+ VERSION = '1.0.8'
4
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: GunnyLog
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - GunnyHwy