我已将Fabric设置为使用以下信息记录与INFO或更高级别相关的所有SSH/Paramiko相关输出:
logging.basicConfig()
logging.getLogger('ssh.transport').setLevel(logging.INFO)
Run Code Online (Sandbox Code Playgroud)
这会导致日志看起来像这样:
[host1] Executing task 'task1'
[host1] Run: ls
...
Run Code Online (Sandbox Code Playgroud)
是否可以更改ssh.transport记录器的格式化程序,以便每行还在其旁边打印日期和时间?
我试图在MonoMac/Xamarin.Mac中创建一个没有停靠图标的应用程序,在启动时也没有可见窗口,并且在右上方的菜单栏中只有一个图标.
我在Info.plist中设置了LSUIElement = 1(尝试了String和Boolean类型),但在应用程序启动时根本不显示状态菜单图标.我可以让它出现的唯一方法是删除LSUIElement标志,尽管Dock图标变得可见.
我使用的代码片段是:
public partial class AppDelegate : NSApplicationDelegate
{
public AppDelegate ()
{
}
public override void FinishedLaunching (NSObject notification)
{
// Construct menu that will be displayed when tray icon is clicked
var notifyMenu = new NSMenu();
var exitMenuItem = new NSMenuItem("Quit",
(a,b) => { System.Environment.Exit(0); }); // Just add 'Quit' command
notifyMenu.AddItem(exitMenuItem);
// Display tray icon in upper-right-hand corner of the screen
var sItem = NSStatusBar.SystemStatusBar.CreateStatusItem(30);
sItem.Menu = notifyMenu;
sItem.Image = NSImage.FromStream(System.IO.File.OpenRead(
NSBundle.MainBundle.ResourcePath + @"/menu_connected.png")); …Run Code Online (Sandbox Code Playgroud)