当前位置: 首页>>代码示例>>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;未经允许,请勿转载。