Module: Yake
- Defined in:
- lib/yake/api.rb,
lib/yake/dsl.rb,
lib/yake/errors.rb,
lib/yake/logger.rb,
lib/yake/datadog.rb,
lib/yake/version.rb
Defined Under Namespace
Modules: API, DSL, Datadog, Errors, Logger
Constant Summary collapse
- VERSION =
'1.2.1'
Class Attribute Summary collapse
- .logger ⇒ Object
-
.pretty ⇒ Object
writeonly
Sets the attribute pretty.
Class Method Summary collapse
Class Attribute Details
.pretty=(value) ⇒ Object (writeonly)
Sets the attribute pretty
34 35 36 |
# File 'lib/yake/logger.rb', line 34 def pretty=(value) @pretty = value end |
Class Method Details
.pretty? ⇒ Boolean
37 |
# File 'lib/yake/logger.rb', line 37 def pretty? = @pretty == true |
.wrap(event = nil, context = nil, &block) ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/yake/dsl.rb', line 38 def wrap(event = nil, context = nil, &block) 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 === res }") } logger.info("EVENT #{ jsonify === event }") (yield(event, context) if block_given?).tap(&log_return) ensure logger.progname = original_progname end |