python 织物日志记录

发布于 2025-01-04 22:23:57 字数 406 浏览 2 评论 0原文

我遇到了织物模块 - 它真的很酷。这对我来说效果很好。现在我有一个问题,如何从结构脚本收集输出?

# cat fabfile.py
from fabric.api import *
from fabric.contrib.console import confirm

env.hosts = ['localhost' , '172.16.10.112','172.16.10.106']
env.user='testuser'
env.password = 'testuser'
@parallel
def uptime():
    run('uname -a')

我想将日志记录模块与 Fabric 一起使用,并在代码本身中使用它们。-不想使用像“fab uptime &> log.out ”这样的正常重定向

I came across fabric modules - Its really cool. It works well for me. Now I have an issue ,how to collect output from fabric script?

# cat fabfile.py
from fabric.api import *
from fabric.contrib.console import confirm

env.hosts = ['localhost' , '172.16.10.112','172.16.10.106']
env.user='testuser'
env.password = 'testuser'
@parallel
def uptime():
    run('uname -a')

I would like to use logging modules with fabric and use them inside the code itself .- Don't want to use normal redirection like "fab uptime &> log.out "

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小矜持 2025-01-11 22:23:57

看起来 fabric 本身并不使用 logging

Issue#57 已经就此问题展开,但恐怕直到它修复为止需要坚持重定向或查看 github 中的一些分支并进行更改才能做到这一点:

It looks like fabric itself doesn't use logging.

Issue#57 is already opened regarding that, but I'm afraid that until it's fixed you'll need to stick to redirection or have a look at some of the branches in github with changes to do that:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文