forked from q191201771/lal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
base.go
48 lines (39 loc) · 1.09 KB
/
base.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
// Copyright 2020, Chef. All rights reserved.
// https://github.com/forkiss/lal
//
// Use of this source code is governed by a MIT-style license
// that can be found in the License file.
//
// Author: Chef (191201771@qq.com)
package base
import (
"os"
"strings"
"time"
"github.com/forkiss/naza/pkg/bininfo"
)
// base包提供被其他多个package依赖的基础内容,自身不依赖任何package
//
// TODO chef: 考虑部分内容放入关联的协议package的子package中
var startTime string
// ReadableNowTime 当前时间,可读字符串形式
//
func ReadableNowTime() string {
return time.Now().Format("2006-01-02 15:04:05.999")
}
func GetWd() string {
dir, _ := os.Getwd()
return dir
}
func LogoutStartInfo() {
Log.Infof(" start: %s", startTime)
Log.Infof(" wd: %s", GetWd())
Log.Infof(" args: %s", strings.Join(os.Args, " "))
Log.Infof(" bininfo: %s", bininfo.StringifySingleLine())
Log.Infof(" version: %s", LalFullInfo)
Log.Infof(" github: %s", LalGithubSite)
Log.Infof(" doc: %s", LalDocSite)
}
func init() {
startTime = ReadableNowTime()
}