forked from linuxdeepin/dde-daemon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebug.go
43 lines (34 loc) · 749 Bytes
/
debug.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
package debug
import (
"github.com/linuxdeepin/dde-daemon/loader"
"github.com/linuxdeepin/go-lib/log"
)
var (
logger = log.NewLogger("daemon/debug")
)
type Daemon struct {
*loader.ModuleBase
}
func NewDaemon() *Daemon {
var d = new(Daemon)
d.ModuleBase = loader.NewModuleBase("debug", d, logger)
return d
}
func (*Daemon) GetDependencies() []string {
return []string{}
}
func (d *Daemon) Start() error {
if d.LogLevel() != log.LevelDebug {
loader.ToggleLogDebug(true)
}
return nil
}
func (d *Daemon) Stop() error {
if d.LogLevel() == log.LevelDebug {
loader.ToggleLogDebug(false)
}
return nil
}