LogNotes does not work with standard ruby logger #98

Closed
mschuerig opened this Issue Nov 11, 2013 · 1 comment

Comments

Projects
None yet
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

This comment has been minimized.

Show comment Hide comment
@Intrepidd

Intrepidd Mar 24, 2014

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

Collaborator

Intrepidd commented Mar 24, 2014

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 Mar 24, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment