Class: Sapience::Subscriber
- Extended by:
- Descendants
- Defined in:
- lib/sapience/subscriber.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#app_name ⇒ Object
Allow app_name to be set globally or per subscriber.
-
#formatter ⇒ Object
Every logger has its own formatter.
-
#host ⇒ Object
Allow host name to be set globally or per subscriber.
Attributes inherited from Base
Instance Method Summary collapse
-
#close ⇒ Object
A subscriber should implement close if it can.
-
#default_formatter ⇒ Object
Returns [Sapience::Formatters::Default] formatter default for this subscriber.
-
#flush ⇒ Object
A subscriber should implement flush if it can.
-
#level ⇒ Object
Returns the current log level if set, otherwise it logs everything it receives.
- #name ⇒ Object
-
#to_s ⇒ Object
TODO: Implement a format string with class name and interesting values see: - www.rubysteps.com/articles/2015/customize-your-ruby-classes-with-to-s-and-inspect/ - stackoverflow.com/questions/9524698/override-to-s-while-keeping-output-of-inspect - stackoverflow.com/questions/2625667/why-do-this-ruby-object-have-both-to-s-and-inspect-methods-that-appear-to-do-the.
-
#valid? ⇒ Boolean
TODO: Implement this mehtod in all appenders TODO: Output relevant message when appender isn’t valid TODO: Check this valid? method before using appender, output above error message if not valid? TODO: Wait with adding appenders until they are needed solve this by below TODO: Implement possibility of finding and deleting appenders by env.
Methods included from Descendants
Methods inherited from Base
#fast_tag, #level=, #payload, #pop_tags, #push_tags, #silence, #tagged, #tags, #with_payload
Methods included from LogMethods
#debug, #debug?, #error, #error!, #error?, #fatal, #fatal!, #fatal?, #info, #info?, #level_to_index, #log_with_exception, #log_with_level, #measure, #measure_debug, #measure_error, #measure_fatal, #measure_info, #measure_trace, #measure_warn, #trace, #trace?, #warn, #warn?
Instance Attribute Details
#app_name ⇒ Object
Allow app_name to be set globally or per subscriber
56 57 58 |
# File 'lib/sapience/subscriber.rb', line 56 def app_name @app_name || Sapience.app_name end |
#formatter ⇒ Object
Every logger has its own formatter
8 9 10 |
# File 'lib/sapience/subscriber.rb', line 8 def formatter @formatter end |
Instance Method Details
#close ⇒ Object
A subscriber should implement close if it can.
46 47 48 |
# File 'lib/sapience/subscriber.rb', line 46 def close # NOOP end |
#default_formatter ⇒ Object
Returns [Sapience::Formatters::Default] formatter default for this subscriber
51 52 53 |
# File 'lib/sapience/subscriber.rb', line 51 def default_formatter Sapience::Formatters::Default.new end |
#flush ⇒ Object
A subscriber should implement flush if it can.
19 20 21 |
# File 'lib/sapience/subscriber.rb', line 19 def flush # NOOP end |
#level ⇒ Object
Returns the current log level if set, otherwise it logs everything it receives
14 15 16 |
# File 'lib/sapience/subscriber.rb', line 14 def level @level || :trace end |
#name ⇒ Object
41 42 43 |
# File 'lib/sapience/subscriber.rb', line 41 def name self.class.name end |
#to_s ⇒ Object
TODO: Implement a format string with class name and interesting values see:
- https://www.rubysteps.com/articles/2015/customize-your-ruby-classes-with-to-s-and-inspect/
- http://stackoverflow.com/questions/9524698/override-to-s-while-keeping-output-of-inspect
- http://stackoverflow.com/questions/2625667/why-do-this-ruby-object-have-both-to-s-and-inspect-methods-that-appear-to-do-the
37 38 39 |
# File 'lib/sapience/subscriber.rb', line 37 def to_s name end |
#valid? ⇒ Boolean
TODO: Implement this mehtod in all appenders TODO: Output relevant message when appender isn’t valid TODO: Check this valid? method before using appender, output above error message if not valid? TODO: Wait with adding appenders until they are needed solve this by below TODO: Implement possibility of finding and deleting appenders by env
28 29 30 |
# File 'lib/sapience/subscriber.rb', line 28 def valid? fail NotImplementedError, "needs to be implemented in appender" end |