Class: Logster::BaseStore

Inherits:
Object
  • Object
show all
Defined in:
lib/logster/base_store.rb

Direct Known Subclasses

RedisStore

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBaseStore

Returns a new instance of BaseStore.



7
8
9
10
11
# File 'lib/logster/base_store.rb', line 7

def initialize
  @dedup = false
  @max_retention = 60 * 60 * 24 * 7
  @skip_empty = true
end

Instance Attribute Details

#ignoreObject

Returns the value of attribute ignore.



5
6
7
# File 'lib/logster/base_store.rb', line 5

def ignore
  @ignore
end

#levelObject

Returns the value of attribute level.



5
6
7
# File 'lib/logster/base_store.rb', line 5

def level
  @level
end

#max_retentionObject

Returns the value of attribute max_retention.



5
6
7
# File 'lib/logster/base_store.rb', line 5

def max_retention
  @max_retention
end

#skip_emptyObject

Returns the value of attribute skip_empty.



5
6
7
# File 'lib/logster/base_store.rb', line 5

def skip_empty
  @skip_empty
end

Instance Method Details

#clearObject



21
22
23
# File 'lib/logster/base_store.rb', line 21

def clear
  not_implemented
end

#clear_allObject



25
26
27
# File 'lib/logster/base_store.rb', line 25

def clear_all
  not_implemented
end

#countObject



17
18
19
# File 'lib/logster/base_store.rb', line 17

def count
  not_implemented
end

#get(message_key) ⇒ Object



29
30
31
# File 'lib/logster/base_store.rb', line 29

def get(message_key)
  not_implemented
end

#protect(message_key) ⇒ Object



33
34
35
# File 'lib/logster/base_store.rb', line 33

def protect(message_key)
  not_implemented
end

#report(severity, progname, msg, opts = {}) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/logster/base_store.rb', line 41

def report(severity, progname, msg, opts = {})
  return if (!msg || (String === msg && msg.empty?)) && skip_empty
  return if level && severity < level

  message = Logster::Message.new(severity, progname, msg, opts[:timestamp])

  env = opts[:env]
  backtrace = opts[:backtrace]

  if env
    if env[:backtrace]
      # Special - passing backtrace through env
      backtrace = env.delete(:backtrace)
    end

    message.populate_from_env(env)
  end

  if backtrace
    if backtrace.respond_to? :join
      backtrace = backtrace.join("\n")
    end
    message.backtrace = backtrace
  else
    message.backtrace = caller.join("\n")
  end

  return if ignore && ignore.any? { |pattern| message =~ pattern}

  save message

  message
end

#save(message) ⇒ Object



13
14
15
# File 'lib/logster/base_store.rb', line 13

def save(message)
  not_implemented
end

#unprotect(message_key) ⇒ Object



37
38
39
# File 'lib/logster/base_store.rb', line 37

def unprotect(message_key)
  not_implemented
end