Skip to content

Improve built-in support for formatted output #2

@pvdb

Description

@pvdb

By using the new "complex formatting" feature in Ruby 1.9, we can significantly improve the built-in support for formatted output.

By implementing the to_hash method on each log line, we could replace something like this:

puts [remote_addr, http_user_agent].join('  =>  ')

... with something like this:

puts "%{remote_addr} => %{http_user_agent}" % self.to_hash

... or even override the puts method on log line instances, and make the hash implicit in the DSL:

puts "%{remote_addr} => %{http_user_agent}"

/cc @jspc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions