-
Notifications
You must be signed in to change notification settings - Fork 4
/
log.go
58 lines (45 loc) · 1.19 KB
/
log.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Copyright © 2015-2020 Platina Systems, Inc. All rights reserved.
// Use of this source code is governed by the GPL-2 license described in the
// LICENSE file.
package log
import (
"errors"
"github.com/platinasystems/goes/external/log"
"github.com/platinasystems/goes/lang"
)
type Command struct{}
func (Command) String() string { return "log" }
func (Command) Usage() string {
return "log [PRIORITY [FACILITY]] TEXT..."
}
func (Command) Apropos() lang.Alt {
return lang.Alt{
lang.EnUS: "print text to /dev/kmsg",
}
}
func (Command) Man() lang.Alt {
return lang.Alt{
lang.EnUS: `
DESCRIPTION
Logged text may be viewed with 'dmesg' command.
PRIORITIES
emerg, alert, crit, err, warn, note, info, debug
The default priority is: info.
FACILITIES
kern, user, mail, daemon, auth, syslog, lpr, news, uucp, cron, priv,
ftp, local0, local1, local2, local3, local4, local5, local6, local7
The default priority is: user.`,
}
}
func (Command) Main(args ...string) error {
if len(args) == 0 {
return errors.New("TEXT: missing")
}
argv := make([]interface{}, 0, len(args))
defer func() { argv = argv[:0] }()
for _, s := range args {
argv = append(argv, s)
}
log.Print(argv...)
return nil
}