Module: Yake
- Defined in:
- lib/yake/dsl.rb,
lib/yake/api.rb,
lib/yake/errors.rb,
lib/yake/logger.rb,
lib/yake/datadog.rb,
lib/yake/version.rb
Overview
Yake
Defined Under Namespace
Modules: API, DSL, Datadog, Errors, Logger
Constant Summary collapse
- VERSION =
'1.3.0'
Class Attribute Summary collapse
- .logger ⇒ Object
-
.pretty ⇒ Object
writeonly
Sets the attribute pretty.
Class Method Summary collapse
- .pretty? ⇒ Boolean
-
.wrap(event = nil, context = nil) ⇒ Object
rubocop: disable Metrics/AbcSize.
Class Attribute Details
.pretty=(value) ⇒ Object (writeonly)
Sets the attribute pretty
36 37 38 |
# File 'lib/yake/logger.rb', line 36 def pretty=(value) @pretty = value end |
Class Method Details
.pretty? ⇒ Boolean
39 |
# File 'lib/yake/logger.rb', line 39 def pretty? = @pretty == true |
.wrap(event = nil, context = nil) ⇒ Object
rubocop: disable Metrics/AbcSize
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/yake/dsl.rb', line 43 def wrap(event = nil, context = nil, &) # rubocop: disable Metrics/AbcSize original_progname = logger.progname logger.progname = context&.aws_request_id jsonify = ->(obj) { pretty? ? JSON.pretty_generate(obj) : obj.to_json } log_return = ->(res) { logger.info("RETURN #{jsonify.call(res)}") } logger.info("EVENT #{jsonify.call(event)}") (yield(event, context) if block_given?).tap(&log_return) ensure logger.progname = original_progname end |