Module: Smash::CloudPowers::Helpers

Instance Method Summary collapse

Methods included from PathHelp

#common_delimiter, #expand_path, #file_exists?, #file_search, #filename?, #job_exist?, #job_path, #job_require_path, #path_search, #paths_gcd, #paths_lcd, #to_path, #to_pathname, #to_realpath, #touch, #zlib_path

Methods included from LogicHelp

#attr_map, #called_from, #i_var_hash, #instance_attr_accessor, #smart_retry, #update_message_body, #wait_until

Methods included from LangHelp

#deep_modify_keys_with, #extract!, #find_and_remove, #format_error_message, #from_json, #modify_keys_with, #to_basic_hash, #to_camel, #to_hyph, #to_i_var, #to_pascal, #to_ruby_file_name, #to_snake, #valid_json?, #valid_url?

Instance Method Details

#create_logger(log_to = STDOUT) ⇒ Object

creates a default logger

Parameters

  • log_to String (optional) - location to send logging information to; default is STDOUT

Returns Logger

Notes

  • TODO: at least make this have overridable defaults



29
30
31
32
33
# File 'lib/cloud_powers/helpers.rb', line 29

def create_logger(log_to = STDOUT)
  logger = Logger.new(log_to)
  logger.datetime_format = '%Y-%m-%d %H:%M:%S'
  logger
end

#log_fileObject

Gets the path from the environment and sets @log_file using the path

Returns Notes

  • See #zfind()



42
43
44
# File 'lib/cloud_powers/helpers.rb', line 42

def log_file
  @log_file ||= zfind('LOG_FILE')
end

#loggerObject

Returns An instance of Logger, cached as @logger@log_file path <String>

Returns Logger

Notes

  • See #create_logger



53
54
55
# File 'lib/cloud_powers/helpers.rb', line 53

def logger
  @logger ||= create_logger
end