logue 1.0.8 → 1.0.9

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: a3d4405454050091913dfa971aeb278078d431b1
4
- data.tar.gz: 8a07f226220c9829f09f62da75a3fad08ac12f0f
3
+ metadata.gz: 50c631370d89c9801cdd921d69062367afc6dcf4
4
+ data.tar.gz: e717280f09746f258be9bfce45429a0d16e085f5
5
5
  SHA512:
6
- metadata.gz: db149d129f19bc569a6dce1cb945741821bdcc7ab5c89511463cd4f7f3cfcd8e55b135aa3f8c71a28341bd8af6f4fa319ce83c8970e35fb0f2287ea2848a0794
7
- data.tar.gz: 50aeb6028db277427a7ae453205df31d61148bfcd0e5478cf126d65ab0d64f5e065294005fc196bf45f035df3702b6fadb5d59477cd5e34b4cb3e3306d7fdf28
6
+ metadata.gz: ffcaadb309d8bc25b31e8e0afb20794843ee14d06647dbfee7c40ef8cfcef4857ff8f03efb93ac3d49e12ed58529e07b9e7601d7b74c87409fffdfd996dc6ffa
7
+ data.tar.gz: 53e1c1d6f8aaf4ab8868bc4d4e30f52f4b826582363bf4062af4069460931886f1916d681e366519508215d58e7fcaeeede92e8603004de18cbc94122a9ad931
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/.glarkrc ADDED
@@ -0,0 +1 @@
1
+ skip-path: pkg
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in logue.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,28 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ logue (1.0.9)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ paramesan (0.1.1)
10
+ power_assert (1.1.1)
11
+ rainbow (3.0.0)
12
+ rake (10.5.0)
13
+ test-unit (3.2.7)
14
+ power_assert
15
+
16
+ PLATFORMS
17
+ ruby
18
+
19
+ DEPENDENCIES
20
+ bundler (~> 1.16)
21
+ logue!
22
+ paramesan (~> 0.1.1)
23
+ rainbow (~> 3.0.0)
24
+ rake (~> 10.0)
25
+ test-unit (~> 3.1)
26
+
27
+ BUNDLED WITH
28
+ 1.16.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Jeff Pace
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "arbolobra"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'pathname'
5
+
6
+ module Logue
7
+ class Frame
8
+ FRAME_RE = Regexp.new '(.*):(\d+)(?::in \`(.*)\')?'
9
+
10
+ attr_reader :path
11
+ attr_reader :line
12
+ attr_reader :function
13
+
14
+ def initialize args
15
+ if entry = args[:entry]
16
+ md = FRAME_RE.match entry
17
+ # Ruby 1.9 expands the file name, but 1.8 doesn't:
18
+ @path = Pathname.new(md[1]).expand_path.to_s
19
+ @line = md[2].to_i
20
+ @function = md[3] || ""
21
+ else
22
+ @path = args[:path]
23
+ @line = args[:line]
24
+ @function = args[:function]
25
+ end
26
+ end
27
+ end
28
+ end
data/lib/logue/line.rb ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'logue/location_format'
5
+
6
+ module Logue
7
+ end
8
+
9
+ class Logue::Line
10
+ attr_reader :location
11
+ attr_reader :msg
12
+
13
+ def initialize location, msg
14
+ @location = location
15
+ @msg = msg
16
+ end
17
+
18
+ def format locformat
19
+ logmsg = @location.format locformat
20
+ logmsg + " " + @msg
21
+ end
22
+ end
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'logue/location_format'
5
+
6
+ module Logue
7
+ end
8
+
9
+ class Logue::Location
10
+ attr_reader :path
11
+ attr_reader :lineno
12
+ attr_reader :cls
13
+ attr_reader :function
14
+
15
+ def initialize path, lineno, cls, function
16
+ @path = path
17
+ @lineno = lineno
18
+ @cls = cls
19
+ @function = function
20
+ end
21
+
22
+ def format locformat
23
+ locformat.format @path, @lineno, @cls, @function
24
+ end
25
+ end
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'logue/pathutil'
5
+
6
+ class Logue::LocationFormatWidths
7
+ DEFAULT_FILENAME = -25
8
+ DEFAULT_LINE = 4
9
+ DEFAULT_FUNCTION = -20
10
+ end
11
+
12
+ class Logue::LocationFormat
13
+ attr_accessor :file
14
+ attr_accessor :line
15
+ attr_accessor :function
16
+ attr_accessor :trim
17
+
18
+ def initialize args = Hash.new
19
+ @file = args.fetch :file, Logue::LocationFormatWidths::DEFAULT_FILENAME
20
+ @line = args.fetch :line, Logue::LocationFormatWidths::DEFAULT_LINE
21
+ @function = args.fetch :function, Logue::LocationFormatWidths::DEFAULT_FUNCTION
22
+ @trim = args.fetch :trim, true
23
+ end
24
+
25
+ def copy args
26
+ values = { file: @file, line: @line, function: @function, trim: @trim }
27
+ self.class.new values.merge(args)
28
+ end
29
+
30
+ def format path, line, cls, func
31
+ if cls
32
+ func = cls.to_s + "#" + func
33
+ end
34
+
35
+ if trim
36
+ path = Logue::PathUtil.trim_right path, @file
37
+ func = Logue::PathUtil.trim_left func, @function
38
+ end
39
+
40
+ format = "[%#{file}s:%#{@line}d] {%#{function}s}"
41
+ sprintf format, path, line, func
42
+ end
43
+
44
+ def format_string
45
+ "[%#{file}s:%#{line}d] {%#{function}s}"
46
+ end
47
+ end
data/lib/logue/logger.rb CHANGED
@@ -10,10 +10,12 @@
10
10
  #
11
11
 
12
12
  require 'rainbow/x11_color_names'
13
+ require 'rainbow/color'
13
14
  require 'pathname'
14
15
  require 'logue/severity'
15
- require 'logue/format'
16
+ require 'logue/location_format'
16
17
  require 'logue/pathutil'
18
+ require 'logue/frame'
17
19
 
18
20
  #
19
21
  # == Logger
@@ -30,9 +32,6 @@ module Logue
30
32
  end
31
33
 
32
34
  class Logue::Logger
33
- $LOGGING_LEVEL = nil
34
-
35
- attr_accessor :quiet
36
35
  attr_accessor :output
37
36
  attr_accessor :colorize_line
38
37
  attr_accessor :level
@@ -40,14 +39,12 @@ class Logue::Logger
40
39
  attr_accessor :ignored_methods
41
40
  attr_accessor :ignored_classes
42
41
 
43
- attr_reader :trim
42
+ attr_accessor :format
44
43
 
45
44
  include Logue::Log::Severity
46
45
 
47
- FRAME_RE = Regexp.new('(.*):(\d+)(?::in \`(.*)\')?')
48
-
49
46
  def initialize
50
- set_defaults
47
+ reset
51
48
  end
52
49
 
53
50
  def verbose= v
@@ -61,46 +58,42 @@ class Logue::Logger
61
58
  end
62
59
  end
63
60
 
64
- def set_defaults
65
- $LOGGING_LEVEL = @level = FATAL
61
+ def reset
62
+ @level = FATAL
66
63
  @ignored_files = Hash.new
67
64
  @ignored_methods = Hash.new
68
65
  @ignored_classes = Hash.new
69
66
  @output = $stdout
70
67
  @colors = Array.new
71
68
  @colorize_line = false
72
- @quiet = false
73
- @trim = true
74
-
75
- @format = Logue::Format.new
76
-
77
- set_default_widths
69
+ @format = Logue::LocationFormat.new
78
70
  end
79
71
 
80
72
  def trim= what
81
73
  end
82
74
 
75
+ def verbose
76
+ level <= DEBUG
77
+ end
78
+
83
79
  def set_default_widths
84
- set_widths Logue::FormatWidths::DEFAULT_FILENAME, Logue::FormatWidths::DEFAULT_LINENUM, Logue::FormatWidths::DEFAULT_FUNCTION
80
+ @format = Logue::LocationFormat.new
85
81
  end
86
82
 
87
83
  def verbose
88
84
  level <= DEBUG
89
85
  end
90
86
 
91
- # Assigns output to a file with the given name. Returns the file; client
92
- # is responsible for closing it.
87
+ # Assigns output to a file with the given name. Returns the file; the client is responsible for
88
+ # closing it.
93
89
  def outfile= f
94
90
  @output = f.kind_of?(IO) ? f : File.new(f, "w")
95
91
  end
96
92
 
97
- # Creates a printf format for the given widths, for aligning output. To lead
98
- # lines with zeros (e.g., "00317") the line_width argument must be a string,
99
- # not an integer.
100
- def set_widths file_width, line_width, func_width
101
- @file_width = file_width
102
- @line_width = line_width
103
- @function_width = func_width
93
+ # Creates a printf format for the given widths, for aligning output. To lead lines with zeros
94
+ # (e.g., "00317") the line_width argument must be a string, not an integer.
95
+ def set_widths file, line, function
96
+ @format = Logue::LocationFormat.new file: file, line: line, function: function
104
97
  end
105
98
 
106
99
  def ignore_file fname
@@ -178,29 +171,16 @@ class Logue::Logger
178
171
  end
179
172
 
180
173
  def print_stack_frame frame, cname, msg, lvl, &blk
181
- md = FRAME_RE.match frame
182
- file, line, func = md[1], md[2], (md[3] || "")
183
- # file.sub!(/.*\//, "")
184
-
185
- # Ruby 1.9 expands the file name, but 1.8 doesn't:
186
- pn = Pathname.new(file).expand_path
174
+ frm = Logue::Frame.new entry: frame
175
+ func = cname ? cname + "#" + frm.function : frm.function
187
176
 
188
- file = pn.to_s
189
-
190
- if cname
191
- func = cname + "#" + func
192
- end
193
-
194
- if ignored_files[file] || (cname && ignored_classes[cname]) || ignored_methods[func]
195
- # skip this one.
196
- else
197
- print_formatted(file, line, func, msg, lvl, &blk)
177
+ unless ignored_files[frm.path] || (cname && ignored_classes[cname]) || ignored_methods[func]
178
+ print_formatted(frm.path, frm.line, func, msg, lvl, &blk)
198
179
  end
199
180
  end
200
181
 
201
182
  def print_formatted file, line, func, msg, lvl, &blk
202
- fmt = Logue::Format.new file_width: @file_width, line_width: @line_width, method_width: @function_width, trim: @trim
203
- location = fmt.format file, line, nil, func
183
+ location = @format.format file, line, nil, func
204
184
  print location, msg, lvl, &blk
205
185
  end
206
186
 
@@ -245,7 +225,8 @@ class Logue::Logger
245
225
  end
246
226
 
247
227
  def respond_to? meth
248
- validcolors = Rainbow::X11ColorNames::NAMES
228
+ # validcolors = Rainbow::X11ColorNames::NAMES
229
+ validcolors = Rainbow::Color::Named::NAMES
249
230
  validcolors.include?(meth) || super
250
231
  end
251
232
 
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ module Logue
5
+ VERSION = '1.0.9'
6
+ end
data/lib/logue.rb CHANGED
@@ -11,7 +11,3 @@ Pathname.glob(loguelibdir + '/logue/**/*.rb').each do |file|
11
11
  fname = file.sub(Regexp.new('^' + loguelibdir + '/'), '').sub(rbre, '')
12
12
  require fname
13
13
  end
14
-
15
- module Logue
16
- VERSION = '1.0.8'
17
- end
data/logue.gemspec ADDED
@@ -0,0 +1,38 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "logue/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "logue"
8
+ spec.version = Logue::VERSION
9
+ spec.authors = ["Jeff Pace"]
10
+ spec.email = ["jeugenepace@gmail.com"]
11
+
12
+ spec.summary = %q{A minimalist logging module.}
13
+ spec.description = %q{A module that adds logging/trace functionality.}
14
+ spec.homepage = "https://www.github.com/jpace/logue"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against " \
23
+ "public gem pushes."
24
+ end
25
+
26
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
+ f.match(%r{^(test|spec|features)/})
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ spec.add_development_dependency "bundler", "~> 1.16"
34
+ spec.add_development_dependency "rainbow", "~> 3.0.0"
35
+ spec.add_development_dependency "rake", "~> 10.0"
36
+ spec.add_development_dependency "test-unit", "~> 3.1"
37
+ spec.add_development_dependency "paramesan", "~> 0.1.1"
38
+ end
metadata CHANGED
@@ -1,66 +1,119 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logue
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Pace
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-08 00:00:00.000000000 Z
11
+ date: 2018-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rainbow
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
31
  - - "~>"
18
32
  - !ruby/object:Gem::Version
19
- version: '2.0'
20
- - - ">="
33
+ version: 3.0.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 3.0.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
21
46
  - !ruby/object:Gem::Version
22
- version: 2.0.0
23
- type: :runtime
47
+ version: '10.0'
48
+ type: :development
24
49
  prerelease: false
25
50
  version_requirements: !ruby/object:Gem::Requirement
26
51
  requirements:
27
52
  - - "~>"
28
53
  - !ruby/object:Gem::Version
29
- version: '2.0'
30
- - - ">="
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: test-unit
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.1'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
31
67
  - !ruby/object:Gem::Version
32
- version: 2.0.0
68
+ version: '3.1'
69
+ - !ruby/object:Gem::Dependency
70
+ name: paramesan
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.1.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.1.1
33
83
  description: A module that adds logging/trace functionality.
34
- email: jpace317@gmail.com
84
+ email:
85
+ - jeugenepace@gmail.com
35
86
  executables: []
36
87
  extensions: []
37
- extra_rdoc_files:
38
- - README.md
88
+ extra_rdoc_files: []
39
89
  files:
90
+ - ".gitignore"
91
+ - ".glarkrc"
92
+ - Gemfile
93
+ - Gemfile.lock
94
+ - LICENSE.txt
40
95
  - README.md
96
+ - Rakefile
97
+ - bin/console
98
+ - bin/setup
41
99
  - lib/logue.rb
42
100
  - lib/logue/colors.rb
43
- - lib/logue/format.rb
101
+ - lib/logue/frame.rb
102
+ - lib/logue/line.rb
103
+ - lib/logue/location.rb
104
+ - lib/logue/location_format.rb
44
105
  - lib/logue/log.rb
45
106
  - lib/logue/loggable.rb
46
107
  - lib/logue/logger.rb
47
108
  - lib/logue/pathutil.rb
48
109
  - lib/logue/severity.rb
49
- - lib/logue/writer.rb
50
- - test/logue/colors_test.rb
51
- - test/logue/format_test.rb
52
- - test/logue/log_test.rb
53
- - test/logue/loggable_test.rb
54
- - test/logue/logger_test.rb
55
- - test/logue/pathutil_test.rb
56
- - test/logue/testlog/log_stack_test.rb
57
- - test/logue/testlog/log_test.rb
58
- - test/logue/testlog/loggable_test.rb
59
- - test/logue/writer_test.rb
60
- homepage: http://jpace.github.com/logue
110
+ - lib/logue/version.rb
111
+ - logue.gemspec
112
+ homepage: https://www.github.com/jpace/logue
61
113
  licenses:
62
114
  - MIT
63
- metadata: {}
115
+ metadata:
116
+ allowed_push_host: https://rubygems.org
64
117
  post_install_message:
65
118
  rdoc_options: []
66
119
  require_paths:
@@ -81,14 +134,4 @@ rubygems_version: 2.6.3
81
134
  signing_key:
82
135
  specification_version: 4
83
136
  summary: A minimalist logging module.
84
- test_files:
85
- - test/logue/colors_test.rb
86
- - test/logue/format_test.rb
87
- - test/logue/log_test.rb
88
- - test/logue/loggable_test.rb
89
- - test/logue/logger_test.rb
90
- - test/logue/pathutil_test.rb
91
- - test/logue/testlog/log_stack_test.rb
92
- - test/logue/testlog/log_test.rb
93
- - test/logue/testlog/loggable_test.rb
94
- - test/logue/writer_test.rb
137
+ test_files: []
data/lib/logue/format.rb DELETED
@@ -1,38 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # -*- ruby -*-
3
-
4
- require 'logue/pathutil'
5
-
6
- class Logue::FormatWidths
7
- DEFAULT_FILENAME = -25
8
- DEFAULT_LINENUM = 4
9
- DEFAULT_FUNCTION = -20
10
- end
11
-
12
- class Logue::Format
13
- def initialize args = Hash.new
14
- @file_width = args.fetch :file_width, Logue::FormatWidths::DEFAULT_FILENAME
15
- @line_width = args.fetch :line_width, Logue::FormatWidths::DEFAULT_LINENUM
16
- @method_width = args.fetch :method_width, Logue::FormatWidths::DEFAULT_FUNCTION
17
- @trim = args.fetch :trim, true
18
- end
19
-
20
- def copy args
21
- values = { file_width: @file_width, line_width: @line_width, method_width: @method_width, trim: @trim }
22
- self.class.new values.merge(args)
23
- end
24
-
25
- def format path, lineno, cls, func
26
- if cls
27
- func = cls.to_s + "#" + func
28
- end
29
-
30
- if @trim
31
- path = Logue::PathUtil.trim_right path, @file_width
32
- func = Logue::PathUtil.trim_left func, @method_width
33
- end
34
-
35
- format = "[%#{@file_width}s:%#{@line_width}d] {%#{@method_width}s}"
36
- sprintf format, path, lineno, func
37
- end
38
- end
data/lib/logue/writer.rb DELETED
@@ -1,24 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # -*- ruby -*-
3
-
4
- require 'logue/format'
5
-
6
- module Logue
7
- end
8
-
9
- class Logue::Writer
10
- attr_accessor :out
11
-
12
- def initialize out = $stdout
13
- @out = out
14
- end
15
-
16
- def write fmt, stack, nframes, cls = nil
17
- stack[0 ... nframes].each do |frame|
18
- path = frame.absolute_path
19
- lineno = frame.lineno
20
- func = frame.label
21
- @out.puts fmt.format path, lineno, cls, func
22
- end
23
- end
24
- end