Class: KLog::Tools::BuildFormatterConfigurationForLogStructure

Inherits:
Object
  • Object
show all
Defined in:
lib/k_log/tools/build_formatter_configuration_for_log_structure.rb

Overview

This tool will build a Log Structure Formatter configuration by working through the object graph you would like to use with Log Structure

Instance Method Summary collapse

Instance Method Details

#build_sample_config(data) ⇒ Object

Build a sample configuration based on the structure



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/k_log/tools/build_formatter_configuration_for_log_structure.rb', line 11

def build_sample_config(data)
  open_struct_data = KUtil.data.to_open_struct(data)

  lines = [
    '# Usage:',
    '',
    "formatter = #{infer_config(open_struct_data)}",
    '',
    "log.structure(data, heading: 'Insert Heading', line_width: 150, formatter: formatter)"
  ]
  KLog.logger.line
  puts lines
  KLog.logger.line
end