當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Logger.SetDebug方法代碼示例

本文整理匯總了Golang中github.com/sqp/godock/libs/cdtype.Logger.SetDebug方法的典型用法代碼示例。如果您正苦於以下問題:Golang Logger.SetDebug方法的具體用法?Golang Logger.SetDebug怎麽用?Golang Logger.SetDebug使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/sqp/godock/libs/cdtype.Logger的用法示例。


在下文中一共展示了Logger.SetDebug方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Run

// Run starts dock routines and locks the main thread with gtk.
//
// It wraps all backends and clients to start a dock :
// Dbus server, applets manager, GUI, menu and gldi.
//
// Dbus service is enabled by default. Mandatory if enabled, to provide remote control.
// This will prevent launching a 2nd instance without the disable Dbus service option.
//
// You can add custom changes, launched before the start, with CustomHacks.
//
// Run returns true if the dock is able to start. This can be done with:
//   gldi.Lock()      // alias for gtk_main.
//   maindock.Clean() // may be better with defer, but cause confused panic messages.
//
func Run(log cdtype.Logger, getSettings func() maindock.DockSettings) bool {
	settings := getSettings()

	// Logger debug state.
	log.SetDebug(settings.Debug)
	maindock.SetLogger(log)

	// Dock init.
	settings.Init()

	// Load new config settings. New options are in an other file to keep the
	// original config file as compatible with the real dock as possible.
	file, e := globals.DirUserAppData(confown.GuiFilename)
	e = confown.Init(log, file, e)
	log.Err(e, "Load ConfigSettings")

	// Register go internal applets events.
	appmgr := mgrgldi.Register(log)

	// Start the polling loop for go internal applets (can be in DBus with other events).
	if settings.DisableDBus {
		go appmgr.StartLoop()

	} else {
		// DBus service is mandatory if enabled. This prevent double launch.
		dbus, e := serviceDbus(log)
		if log.Err(e, "start dbus service") {
			fmt.Println("restart the program with the -N flag if you really need a second instance")
			return false
		}
		dbus.SetManager(appmgr)
		go dbus.StartLoop()
	}

	// HTTP listener for the pprof debug.
	if settings.HTTPPprof {
		websrv.Service.Register("debug/pprof", pprof.Index, log)
		websrv.Service.Start("debug/pprof")
	}

	// Print useful packages versions.
	versions.Print()

	// Custom calls added by devs for their own uses and tests.
	CustomHacks()

	// Register GUI events.
	backendgui.Register(guibridge.New(log))

	// Register mouse events.
	eventmouse.Register(log)

	// Register menus events.
	backendmenu.Register(log, mainmenu.BuildMenuContainer, mainmenu.BuildMenuIcon)

	// Finish startup.
	settings.Start()

	return true
}
開發者ID:sqp,項目名稱:godock,代碼行數:74,代碼來源:startdock.go


注:本文中的github.com/sqp/godock/libs/cdtype.Logger.SetDebug方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。