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

Scrolls::Decorators #9

Closed
wants to merge 8 commits into from
Closed

Scrolls::Decorators #9

wants to merge 8 commits into from

Conversation

fabiokung
Copy link
Contributor

This is a proposal for an alternative (and simpler) frontend for Scrolls::Log. It should cover the common cases, but the underlying Scrolls::Log.log is still there when needed.

See test_decorators.rb for usage.

Example:

class MyService
  include Scrolls::Decorators

  log_context "myservice", release: "v51"

  def simple_log_with_context
    log
    # output: "myservice release=v51\n"
  end

  def basic_logging
    log "basic", "that", "works", data: "useful", number: 10
    # output: "myservice release=v51 basic that works data=useful number=10\n"
  end

  log
  def wrapping
    sleep 0.1
    # output:
    #  "myservice release=v51 class=MyService method=wrapping at=start\n"
    #  "myservice release=v51 class=MyService method=wrapping at=finish elapsed=0.1"
  end

  # and more ...
end

@asenchi
Copy link
Owner

asenchi commented Jun 19, 2012

I did a nearly full rewrite of Scrolls (v2 branch, going to be merged this week). I am still not sure about the method decorator but love the context decorator. I want to work a version of this PR into the release after v2 is merged/released.

@asenchi
Copy link
Owner

asenchi commented Feb 11, 2013

I've still never grown comfortable with this decorator. I think I am going to close this for now, and will readdress as time passes. I do really love the log_context at the top of a class, that could be really useful, but I don't have the time these days to hack on much, so keeping this lib short and sweet and working is my primary concern.

Thanks!

@asenchi asenchi closed this Feb 11, 2013
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

Successfully merging this pull request may close these issues.

None yet

2 participants