Module: LogDb

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

Overview

our own code

Defined Under Namespace

Modules: Model Classes: CreateDb, DbHandler, Deleter, Server

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 =
1
PATCH =
0
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



34
35
36
# File 'lib/logutils/activerecord.rb', line 34

def self.create
  CreateDb.up
end

.delete!Object

delete ALL records (use with care!)



39
40
41
42
# File 'lib/logutils/activerecord.rb', line 39

def self.delete!
  puts '*** deleting log table records/data...'
  Deleter.new.run
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?



52
53
54
55
# File 'lib/logutils/activerecord.rb', line 52

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

.statsObject



45
46
47
# File 'lib/logutils/activerecord.rb', line 45

def self.stats
  # to be done
end

.versionObject



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

def self.version
  VERSION
end