Sha256: a4e1cb0390d461b8e49f89a7e16ca17fc20d3cfa14a0932a8c5db71e1f300512
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
# frozen_string_literal: true require 'semantic_logger' log_env_str = ENV['RACK_ENV'] || 'dev' log_fname = "log/#{log_env_str}.log" log_level_default = %w(dev test).include?(log_env_str) ? 'trace' : 'info' log_level_str = ENV['LOG_LEVEL'] || log_level_default # Variations: # # 1. `bundle exec ruby test/path/to/your_test.rb` will log to `log/test.log` at # log level `info` unless your environment variables are set to override; # 2. `RACK_ENV=dev bundle exec ruby test/path/to/your_test.rb` will log to # `log/dev.log` at log level `trace` unless the `LOG_LEVEL` environment # variable overrides the level setting; # 3. `LOG_LEVEL=trace bundle exec ruby test/path/to/your_test.rb` will log to # `log/test.log` unless the `RACK_ENV` setting overrides the filename, at log # level `trace`. # # The file `test/test_helper.rb` sets the default `RACK_ENV` to `test` unless # already set. SemanticLogger.default_level = log_level_str.downcase.to_sym SemanticLogger.add_appender file_name: log_fname, formatter: :color
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
article_fixture_gen-0.1.2 | lib/article_fixture_gen/support/logging.rb |
article_fixture_gen-0.1.1 | lib/article_fixture_gen/support/logging.rb |