TwP / logging

A flexible logging library for use in Ruby programs based on the design of Java's log4j library.
https://rubygems.org/gems/logging
MIT License
529 stars 100 forks source link

Base path for file names #154

Closed TwP closed 7 years ago

TwP commented 7 years ago

This PR adds a basepath configuration for the Logging framework. When call tracing is enabled for log events, the reported filenames will be relative to this basepath setting.

Logging.basepath = Rails.root.to_s

Now for your Rails project, all filenames are relative to that path. Messages will contain filenames like this app/model/user.rb instead of the longer /home/sally/projects/rails_app/app/model/user.rb.

fixes #126

/cc @cshupp1 and @vanso-hubsi since you both might have some thoughts on the approach taken here

cshupp1 commented 7 years ago

Seems like a nice API to me. Thank you!

cshupp1 commented 6 years ago

Sad that it has taken this long to respond, but...

C:\work\VSO\vso\logs>cat rails_vso.log [ALWAYS][2018-01-09T14:25:31][/work/VSO/vso/lib/logging/logging.rb][158] Logging started!

It works perfectly! Thanks!