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


Golang log.NewLogger函數代碼示例

本文整理匯總了Golang中pkg/linuxdeepin/com/lib/log.NewLogger函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewLogger函數的具體用法?Golang NewLogger怎麽用?Golang NewLogger使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: Start

func Start() *LangSelector {
	var logger = log.NewLogger(dbusSender)

	if !lib.UniqueOnSession(dbusSender) {
		logger.Warning("There is a LangSelector running...")
		return nil
	}

	logger.BeginTracing()

	_lang = newLangSelector(logger)
	if _lang == nil {
		logger.Error("Create LangSelector Failed")
		return nil
	}

	err := dbus.InstallOnSession(_lang)
	if err != nil {
		logger.Error("Install Session DBus Failed:", err)
		Stop()
		return nil
	}

	_lang.onLocaleSuccess()

	return _lang
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:27,代碼來源:main.go

示例2: init

func init() {
	if logger == nil {
		logger = log.NewLogger("com.deepin.daemon.Power")
	}

	C.Suite(&DBusInterfaceTest{})
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:7,代碼來源:dbus_ifc_test.go

示例3: main

func main() {
	logger := log.NewLogger("dde-daemon/desktop-toggle")
	logger.BeginTracing()
	defer logger.EndTracing()

	X, err := xgbutil.NewConn()
	if err != nil {
		logger.Error("New xgbutil connection failed: ", err)
		panic(err)
	}

	if ret, err := ewmh.ShowingDesktopGet(X); err == nil {
		// !!! NOT using ewmh.ShowingDesktopReq
		// because ewmh.ShowingDesktopReq passes a uint argument,
		// and int is used on xevent.NewClientMessage.
		logger.Info("Show Desktop Status: ", ret)
		var showInt int
		if ret {
			showInt = 0
		} else {
			showInt = 1
		}
		ewmh.ClientEvent(X, X.RootWin(), "_NET_SHOWING_DESKTOP", showInt)
	}
	X.Sync()
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:26,代碼來源:main.go

示例4: NewManager

func NewManager() *Manager {
	var m = Manager{}

	m.logger = log.NewLogger(dbusSender)
	m.monitor = gio.VolumeMonitorGet()
	m.setting, _ = dutils.CheckAndNewGSettings(mediaHandlerSchema)
	m.diskCache = make(map[string]*diskObjectInfo)
	m.endFlag = make(chan struct{})

	m.DiskList = m.getDiskInfos()

	return &m
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:13,代碼來源:manager.go

示例5: Start

func Start() {
	if _sysInfo != nil {
		return
	}

	logger := log.NewLogger("com.deepin.daemon.SystemInfo")
	logger.BeginTracing()

	_sysInfo = NewSystemInfo(logger)
	err := dbus.InstallOnSession(_sysInfo)
	if err != nil {
		logger.Error(err)
		_sysInfo = nil
		logger.EndTracing()
		return
	}
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:17,代碼來源:system_info.go

示例6: NewSystemInfo

func NewSystemInfo(l *log.Logger) *SystemInfo {
	sys := &SystemInfo{}

	if l == nil {
		l = log.NewLogger("com.deepin.daemon.SystemInfo")
	}
	sys.logger = l

	var err error
	sys.Version, err = getVersionFromDeepin("/etc/deepin-version")
	if err != nil {
		sys.logger.Warning(err)
		sys.Version, err = getVersionFromLsb("/etc/lsb-release")
		if err != nil {
			sys.logger.Error(err)
			return nil
		}
	}

	sys.Processor, err = getCPUInfoFromFile("/proc/cpuinfo")
	if err != nil {
		sys.logger.Error(err)
		return nil
	}

	sys.MemoryCap, err = getMemoryCapFromFile("/proc/meminfo")
	if err != nil {
		sys.logger.Error(err)
		return nil
	}

	sys.SystemType, err = getSystemType()
	if err != nil {
		sys.logger.Error(err)
		return nil
	}

	sys.DiskCap, err = getDiskCap()
	if err != nil {
		sys.logger.Error(err)
		return nil
	}

	return sys
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:45,代碼來源:system_info.go

示例7: runAsDaemon

func runAsDaemon() {
	logger := log.NewLogger(grub2.DbusGrubDest + ".Runner")
	logger.BeginTracing()
	defer logger.EndTracing()

	if !lib.UniqueOnSession(grub2.DbusGrubDest) {
		logger.Error("dbus unique:", grub2.DbusGrubDest)
		return
	}
	grub2.Start()
	dbus.SetAutoDestroyHandler(60*time.Second, func() bool {
		return !grub2.IsUpdating()
	})
	dbus.DealWithUnhandledMessage()
	if err := dbus.Wait(); err != nil {
		logger.Error("lost dbus session:", err)
		os.Exit(1)
	}
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:19,代碼來源:main.go

示例8: newLangSelector

func newLangSelector(l *log.Logger) *LangSelector {
	lang := LangSelector{LocaleState: LocaleStateChanged}

	if l != nil {
		lang.logger = l
	} else {
		lang.logger = log.NewLogger(dbusSender)
	}

	var err error
	lang.lhelper, err = localehelper.NewLocaleHelper(
		"com.deepin.api.LocaleHelper",
		"/com/deepin/api/LocaleHelper")
	if err != nil {
		lang.logger.Warning("New LocaleHelper Failed:", err)
		return nil
	}

	lang.setPropCurrentLocale(getLocale())

	return &lang
}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:22,代碼來源:locale.go

示例9: newManager

	"time"
)

type Manager struct {
	writeStart bool
	writeEnd   chan bool
}

const (
	DBUS_DEST = "com.deepin.daemon.Search"
	DBUS_PATH = "/com/deepin/daemon/Search"
	DBUS_IFC  = "com.deepin.daemon.Search"
)

var (
	logger = log.NewLogger(DBUS_DEST)
)

func newManager() *Manager {
	m := Manager{}

	m.writeStart = false

	return &m
}

var _manager *Manager

func GetManager() *Manager {
	if _manager == nil {
		_manager = newManager()
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:31,代碼來源:main.go

示例10: GetBrightness

	C.set_backlight(C.double(v))
}
func (h *BacklightHelper) GetBrightness() float64 {
	h.lock.Lock()
	defer h.lock.Unlock()
	return (float64)(C.get_backlight())
}
func (*BacklightHelper) GetDBusInfo() dbus.DBusInfo {
	return dbus.DBusInfo{
		"com.deepin.daemon.helper.Backlight",
		"/com/deepin/daemon/helper/Backlight",
		"com.deepin.daemon.helper.Backlight",
	}
}

var logger = log.NewLogger("com.deepin.daemon.helper.Backlight")

func main() {
	helper := NewBacklightHelper()
	err := dbus.InstallOnSystem(helper)
	if err != nil {
		logger.Errorf("register dbus interface failed: %v", err)
		os.Exit(1)
	}

	dbus.SetAutoDestroyHandler(time.Second*1, nil)

	dbus.DealWithUnhandledMessage()
	if err := dbus.Wait(); err != nil {
		logger.Errorf("lost dbus session: %v", err)
		os.Exit(1)
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:31,代碼來源:main.go

示例11:

import (
	libarea "dbus/com/deepin/api/xmousearea"
	libdsp "dbus/com/deepin/daemon/display"
	"dbus/com/deepin/dde/launcher"
	"pkg.linuxdeepin.com/lib/dbus"
	"pkg.linuxdeepin.com/lib/gio-2.0"
	"pkg.linuxdeepin.com/lib/log"
	"sync"
)

var (
	dspObj    *libdsp.Display
	areaObj   *libarea.XMouseArea
	launchObj *launcher.Launcher
	logger    = log.NewLogger(ZONE_DEST)

	mutex         = new(sync.Mutex)
	edgeActionMap = make(map[string]string)
)
var zoneSettings = func() func() *gio.Settings {
	var initZoneSettings sync.Once
	var _zoneSettings *gio.Settings

	return func() *gio.Settings {
		initZoneSettings.Do(func() {
			_zoneSettings = gio.NewSettings("com.deepin.dde.zone")
		})
		return _zoneSettings
	}
}()
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:30,代碼來源:main.go

示例12:

package screensaver

import (
	"github.com/BurntSushi/xgb/dpms"
	"github.com/BurntSushi/xgb/screensaver"
	"github.com/BurntSushi/xgb/xproto"
	"github.com/BurntSushi/xgbutil"
	"pkg.linuxdeepin.com/lib/dbus"
	"pkg.linuxdeepin.com/lib/log"
	"sync"
)

var logger = log.NewLogger("org.freedesktop.ScreenSaver")

type inhibitor struct {
	cookie uint32
	name   string
	reason string
}
type ScreenSaver struct {
	xu *xgbutil.XUtil

	IdleOn      func()
	CycleActive func()
	IdleOff     func()

	blank        byte
	idleTime     uint32
	idleInterval uint32

	inhibitors  map[uint32]inhibitor
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:31,代碼來源:screensaver.go

示例13: Reset

package audio

import "pkg.linuxdeepin.com/lib/dbus"
import "pkg.linuxdeepin.com/lib/log"
import "pkg.linuxdeepin.com/lib/pulse"
import libsound "dbus/com/deepin/api/sound"

var logger = log.NewLogger("com.deepin.daemon.Audio")

type Audio struct {
	init bool
	core *pulse.Context

	Sinks         []*Sink
	Sources       []*Source
	SinkInputs    []*SinkInput
	DefaultSink   string
	DefaultSource string

	MaxUIVolume float64

	siEventChan  chan func()
	siPollerExit chan struct{}
}

func (a *Audio) Reset() {
	for _, s := range a.Sinks {
		s.SetVolume(s.BaseVolume, false)
		s.SetBalance(0, false)
		s.SetFade(0)
	}
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:31,代碼來源:audio.go

示例14: getCommandByMimeType

	"pkg.linuxdeepin.com/lib/log"
	"strings"
)

const (
	MPRIS_FILTER_KEY = "org.mpris.MediaPlayer2"
	MPRIS_PATH       = "/org/mpris/MediaPlayer2"
	SEEK_DISTANCE    = int64(5000000) // 5s

	MIME_TYPE_BROWSER = "x-scheme-handler/http"
	MIME_TYPE_EMAIL   = "x-scheme-handler/mailto"
	CALCULATOR_CMD    = "/usr/bin/gnome-calculator"
)

var (
	logger      = log.NewLogger("dde-daemon/mpris")
	dbusObj     *libdbus.DBusDaemon
	mediaKeyObj *libkeybind.MediaKey
	loginObj    *liblogin1.Manager
	prevSender  = ""
)

func getCommandByMimeType(mimeType string) (string, bool) {
	if appInfo := gio.AppInfoGetDefaultForType(mimeType, false); appInfo != nil {
		return appInfo.GetExecutable(), true
	}

	return "", false
}

func getMprisClients() ([]string, bool) {
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:31,代碼來源:mpris.go

示例15: NewManager

 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see <http://www.gnu.org/licenses/>.
 **/

package sessionwatcher

import (
	"pkg.linuxdeepin.com/lib/log"
	"time"
)

var (
	logger = log.NewLogger("dde-daemon/sessionwatcher")
)

type Manager struct {
	dock      *Dock
	appelt    *DockApplet
	exitTimer chan struct{}
}

func NewManager() *Manager {
	m := &Manager{}

	m.dock = NewDock()
	m.appelt = NewDockApplet()
	m.exitTimer = make(chan struct{})
開發者ID:felixonmars,項目名稱:dde-daemon,代碼行數:30,代碼來源:main.go


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