Module: LogDb

Defined in:
lib/logutils/activerecord.rb,
lib/logutils/activerecord/models.rb,
lib/logutils/activerecord/schema.rb,
lib/logutils/activerecord/version.rb

Defined Under Namespace

Modules: Model Classes: CreateDb, DbHandler

Constant Summary collapse

STDDBHANDLER =

default/standard db handler

DbHandler.new
Models =

add convenience module alias in plural e.g. lets you use include LogDb::Models

Model
MAJOR =

todo: namespace inside version or something - why? why not??

0
MINOR =
2
PATCH =
1
VERSION =
[MAJOR,MINOR,PATCH].join('.')

Class Method Summary collapse

Class Method Details



14
15
16
# File 'lib/logutils/activerecord/version.rb', line 14

def self.banner
  "logdb/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
end

.createObject

class DbHandler



31
32
33
# File 'lib/logutils/activerecord.rb', line 31

def self.create
  CreateDb.up
end

.delete!Object

delete ALL records (use with care!)



36
37
38
39
# File 'lib/logutils/activerecord.rb', line 36

def self.delete!
  puts '*** deleting log table records/data...'
  Model::Log.delete_all
end

.rootObject



18
19
20
# File 'lib/logutils/activerecord/version.rb', line 18

def self.root
  "#{File.expand_path( File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) )}"
end

.setupObject

check: use different name? e.g. configure or connect ?? why or why not?



50
51
52
53
# File 'lib/logutils/activerecord.rb', line 50

def self.setup   # check: use different name?  e.g. configure or connect ?? why or why not?
  # turn on logging to db  - assumes active connection
  LogKernel::STDLOGGER.handlers << STDDBHANDLER
end

.statsObject



42
43
44
# File 'lib/logutils/activerecord.rb', line 42

def self.stats
  # to be done
end

.versionObject



10
11
12
# File 'lib/logutils/activerecord/version.rb', line 10

def self.version
  VERSION
end