Class: ChiliLogger
- Inherits:
-
Object
- Object
- ChiliLogger
- Includes:
- Singleton
- Defined in:
- lib/chili_logger.rb,
lib/brokers/sqs_broker.rb,
lib/chili_logger/version.rb,
lib/current_log_accessor.rb,
lib/brokers/rabbit_broker.rb,
lib/helpers/values/default.rb,
lib/message_writer/message_writer.rb,
lib/message_writer/aws_ops_metadata.rb,
lib/errors/error_messages/config_error.rb,
lib/helpers/values/type_uniformizer/desc.rb,
lib/helpers/values/type_uniformizer/user.rb,
lib/helpers/logs_coverage/coverage_writer.rb,
lib/helpers/values/type_uniformizer/main_content.rb,
lib/errors/logging_error_handler/logging_error_handler.rb
Overview
class for centralizing Creative’s logging logic
Defined Under Namespace
Modules: AWS, Values Classes: AwsOpsMetadata, ConfigError, CoverageWriter, CurrentLogAccessor, LoggingErrorHandler, MessageWriter, RabbitBroker
Constant Summary collapse
- VERSION =
'0.0.12'.freeze
Instance Attribute Summary collapse
-
#deactivated ⇒ Object
Returns the value of attribute deactivated.
-
#msg_broker ⇒ Object
readonly
Returns the value of attribute msg_broker.
Instance Method Summary collapse
- #config(config) ⇒ Object
- #current_log ⇒ Object
-
#initialize ⇒ ChiliLogger
constructor
A new instance of ChiliLogger.
- #publish_instant_log(**options) ⇒ Object
- #start_new_log(**options) ⇒ Object
Constructor Details
#initialize ⇒ ChiliLogger
Returns a new instance of ChiliLogger.
22 23 24 25 26 27 |
# File 'lib/chili_logger.rb', line 22 def initialize @default = ChiliLogger::Values::Default.new @user_uniformizer = ChiliLogger::Values::TypeUniformizer::User.new @desc_uniformizer = ChiliLogger::Values::TypeUniformizer::Desc.new @main_content_uniformizer = ChiliLogger::Values::TypeUniformizer::MainContent.new end |
Instance Attribute Details
#deactivated ⇒ Object
Returns the value of attribute deactivated.
17 18 19 |
# File 'lib/chili_logger.rb', line 17 def deactivated @deactivated end |
#msg_broker ⇒ Object (readonly)
Returns the value of attribute msg_broker.
16 17 18 |
# File 'lib/chili_logger.rb', line 16 def msg_broker @msg_broker end |
Instance Method Details
#config(config) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/chili_logger.rb', line 29 def config(config) @deactivated = config[:deactivated] || false # ChilLogger can be deactivated for test environents config_logging_error_handler(config) config_msg_writer(config) config_msg_broker(config) @current_log_accessor = CurrentLogAccessor.new(@msg_broker, @msg_writer) end |
#current_log ⇒ Object
39 40 41 |
# File 'lib/chili_logger.rb', line 39 def current_log @current_log_accessor end |
#publish_instant_log(**options) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/chili_logger.rb', line 53 def publish_instant_log(**) # enforces that all attributes have valid primitive types if [:desc] = @desc_uniformizer.desc([:desc]) [:user] = @user_uniformizer.user([:user]) [:main_content] = @main_content_uniformizer.main_content([:main_content]) end = @msg_writer.write() routing_key = @msg_writer.write_description_tag([:desc]) @msg_broker.publish(, routing_key) end |
#start_new_log(**options) ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'lib/chili_logger.rb', line 43 def start_new_log(**) current_log.clear_log_info current_log.update_desc([:desc]) current_log.update_user([:user]) current_log.update_main_content([:main_content]) current_log end |