Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

LogNotes does not work with standard ruby logger #98

Closed
mschuerig opened this Issue · 1 comment

2 participants

@mschuerig

From Footnotes::Notes::LogNote:

  module LoggingExtensions
    def add(*args, &block)
      logged_message = super
      Footnotes::Notes::LogNote.log(logged_message)
      logged_message
    end
  end

  Rails.logger.extend LoggingExtensions

In a Rails 3.2 app using Ruby 1.9, super is an ActiveSupport::TaggedLogging decorating ActiveSupport::BufferedLogger and finally a ::Logger, i.e. the standard Ruby logger. The #add method there is implemented like this

def add(severity, message = nil, progname = nil, &block)
  ...
  @logdev.write(
    format_message(format_severity(severity), Time.now, progname, message))
  true
end

Note the return value. That's exactly what the PartialsNote gets: true. Instead of the intended, logged text. As a consequence, PartialsNote does not work in this configuration.

Incidentally, I'm wondering why the LogNotes looks at the log at all instead of subscribing to render_partial.action_view. Is this just a case of legacy code?

@Intrepidd
Collaborator

Hi,

I've released footnotes 4.0, I've reworked the log and partial notes, and the partial note nows subscribes to render_partial.action_view.

Feel free to reopen if you encounter any issue.

Cheers

@Intrepidd Intrepidd closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.