Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guide about how to configure the logger #93

Open
wikimatze opened this issue Apr 15, 2016 · 0 comments
Open

Guide about how to configure the logger #93

wikimatze opened this issue Apr 15, 2016 · 0 comments

Comments

@wikimatze
Copy link
Member

Configuring the logger to suit your needs is totally possible with Padrino.

The easiest way is to set the options in config/boot.rb, anytime before Padrino.load!.

Padrino::Logger::Config[:development] = { :log_level => :devel, :format_datetime => " [%Y-%m-%d %H:%M:%S] ", :stream => :to_file }

If you want to redefine your logger at a later stage in your app you will need to run Padrino::Logger.setup! right after your new logger settings.

TODO: Explain the options.

  • @auto_flush = options.has_key?(:auto_flush) ? options[:auto_flush] : true
  • @Level = options[:log_level] ? Padrino::Logger::Levels[options[:log_level]] : Padrino::Logger::Levels[:debug]
  • @log = options[:stream] || $stdout
  • @log.sync = true
  • @format_datetime = options[:format_datetime] || "%d/%b/%Y %H:%M:%S"
  • @format_message = options[:format_message] || "%s - %s %s"
  • @log_static = options.has_key?(:log_static) ? options[:log_static] : false
  • @colorize_logging = options.has_key?(:colorize_logging) ? options[:colorize_logging] : true

Implementation reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant