Class: OSX::BundleSupport::Logger

Inherits:
Object
  • Object
show all
Defined in:
src/ruby/osx/objc/oc_bundle_support.rb

Overview

Logger class for OSX::BundleSupport.

Instance Method Summary (collapse)

Constructor Details

- (Logger) initialize(bdl)

Returns a new instance of Logger



32
33
34
35
# File 'src/ruby/osx/objc/oc_bundle_support.rb', line 32

def initialize(bdl)
  @bundle_name  = bdl.to_s.sub(/^.*<(.*)>.*$/,'\1').split('/').last
  @process_name = OSX::NSProcessInfo.processInfo.processName
end

Instance Method Details

- (Object) backtrace(err)

Prints backtrace.



48
49
50
# File 'src/ruby/osx/objc/oc_bundle_support.rb', line 48

def backtrace(err)
  err.backtrace.each { |s| info("    %s", s) }
end

- (Object) error(err)

Prints error message.



43
44
45
# File 'src/ruby/osx/objc/oc_bundle_support.rb', line 43

def error(err)
  info("%s: %s", err.class, err)
end

- (Object) info(fmt, *args)

Prints message with OSX::NSLog().



38
39
40
# File 'src/ruby/osx/objc/oc_bundle_support.rb', line 38

def info(fmt, *args)
  OSX.NSLog("#{@bundle_name} (#{@process_name}): #{fmt % args}")
end