Class: Logster::BaseStore
- Inherits:
-
Object
- Object
- Logster::BaseStore
- Defined in:
- lib/logster/base_store.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#ignore ⇒ Object
Returns the value of attribute ignore.
-
#level ⇒ Object
Returns the value of attribute level.
-
#max_retention ⇒ Object
Returns the value of attribute max_retention.
-
#skip_empty ⇒ Object
Returns the value of attribute skip_empty.
Instance Method Summary collapse
- #clear ⇒ Object
- #clear_all ⇒ Object
- #count ⇒ Object
- #get(message_key) ⇒ Object
-
#initialize ⇒ BaseStore
constructor
A new instance of BaseStore.
- #protect(message_key) ⇒ Object
- #report(severity, progname, msg, opts = {}) ⇒ Object
- #save(message) ⇒ Object
- #unprotect(message_key) ⇒ Object
Constructor Details
#initialize ⇒ BaseStore
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
#ignore ⇒ Object
Returns the value of attribute ignore.
5 6 7 |
# File 'lib/logster/base_store.rb', line 5 def ignore @ignore end |
#level ⇒ Object
Returns the value of attribute level.
5 6 7 |
# File 'lib/logster/base_store.rb', line 5 def level @level end |
#max_retention ⇒ Object
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_empty ⇒ Object
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
#clear ⇒ Object
21 22 23 |
# File 'lib/logster/base_store.rb', line 21 def clear not_implemented end |
#clear_all ⇒ Object
25 26 27 |
# File 'lib/logster/base_store.rb', line 25 def clear_all not_implemented end |
#count ⇒ Object
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() not_implemented end |
#protect(message_key) ⇒ Object
33 34 35 |
# File 'lib/logster/base_store.rb', line 33 def protect() 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 = 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 .populate_from_env(env) end if backtrace if backtrace.respond_to? :join backtrace = backtrace.join("\n") end .backtrace = backtrace else .backtrace = caller.join("\n") end return if ignore && ignore.any? { |pattern| =~ pattern} save end |
#save(message) ⇒ Object
13 14 15 |
# File 'lib/logster/base_store.rb', line 13 def save() not_implemented end |
#unprotect(message_key) ⇒ Object
37 38 39 |
# File 'lib/logster/base_store.rb', line 37 def unprotect() not_implemented end |