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
Support full logging to file #57
Comments
|
Travis Swicegood (tswicegood) posted: Carrying over the conversation from #135, the core on 2010-01-24 at 09:12pm EST |
|
Jeff Forcier (bitprophet) posted: See #333 for a pull request that does some basic work in this area (though ATM it does not pass tests.) Keep in mind that I want to at least quickly compare the existing logging modules to see if the non-stdlib ones offer enough benefits (cleaner APIs etc) over the stdlib one to be worth using. on 2011-04-19 at 12:43pm EDT |
|
Jeff Forcier (bitprophet) posted: Some prior art using the stdlib module can be found in this GH commit (came from a pull request) on 2011-07-07 at 03:09pm EDT |
|
Jeff Forcier (bitprophet) posted: And recent work by tswicegood, also using the stdlib module and wrapping it a bit, is here on Github on 2011-07-07 at 03:38pm EDT |
|
Adding Invoke label since Invoke will need to log stuff too, and Fabric will then ride on that to some degree (while obviously logging a lot of its own stuff too.) |
|
+1 |
|
A big +1 from me. Has this been added to fabric yet? A bit of a chore to remember to pass every fab command through tee. |
|
yes please, that's somehow a must |
|
👍 |
|
@bitprophet is there something we can help with to bring this feature to life? |
|
👍 |
3 similar comments
|
+1 |
|
👍 |
|
+1 |
|
The current hack I have for this is to set https://github.com/josegonzalez/chef-solo-cup/blob/master/chef_solo_cup/commands/runner.py#L141 |
|
Note: it seems like interactive shells - like asking for passwords - might break in my above implementation, so I still think it would be nice to have it in the core of fabric. |
|
+1 I'm using a ad-hot decorator. But this decorator could not support class Buffered:
def __init__(self, stream):
self.stream = stream
self.buf = []
def write(self, data):
self.buf.append(data)
self.stream.write(data)
self.stream.flush()
def __getattr__(self, attr):
return getattr(self.stream, attr)
def auto_comment(func):
@wraps(func)
def wraper(*args, **kws):
_stdout = sys.stdout
buffered = sys.stdout = Buffered(_stdout)
ret = func(*args, **kws)
if buffered.buf:
# only pick last 500 lines is good enough
echo_result = "".join(buffered.buf[-500:])
# filter the colored results
echo_result = re.sub("\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]", "", echo_result)
# using the result as you want
sys.stdout = _stdout
return ret
return wraper |
|
Is there any plan to include this in the core any time soon? |
|
+1 |
1 similar comment
|
+1 |
|
+1 |
1 similar comment
|
👍 |
|
I also would love a solution to this. |
|
+1 Also, this may help others trying to build a streamlogger |
|
This feature would be nice to have! |
|
+1 |
2 similar comments
|
+1 |
|
+1 |
|
i offer 10bucks for this feature! |
|
Rolling this into pyinvoke/invoke#15, updated its desc with a bunch of thoughts too. |
|
Sorry for replying a closed issue. |
Description
Outside of any further modifications to the stdout/stderr output controls, it would be very handy to log everything to a file; this would give users another alternate channel for debugging their fabfiles without having to wrestle with what they see at runtime.
Main question is whether to output things as if
debugwere set, by default. Thinking to leave it off at first, and have a simple flag/option to turn it on, perhaps--log-debug.Where to log to? By default I'd say user's cwd, though that can get annoying (like "pipturds", i.e.
pip-log.txtfiles that pip drops everywhere.) Unfortunately there's no other great standard location, so perhaps turn logging-to-file off by default? Either way, allow override, say via--log-locationor similar.Unsure whether it makes any sense to utilize the
loggingmodule's concept of levels; the only place I can see it being useful at all is for the debug stuff, but we currently think of debugging as modifying output instead of adding to it -- which doesn't mesh with howloggingworks. So possibly best to just stick everything in, say, INFO for now, then tweak later if necessary.Potential modules:
loggingOriginally submitted by Jeff Forcier (bitprophet) on 2009-09-06 at 10:57am EDT
Relations
The text was updated successfully, but these errors were encountered: