You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lal/pkg/base/base.go

49 lines
1.1 KiB
Go

// Copyright 2020, Chef. All rights reserved.
// https://github.com/q191201771/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/q191201771/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()
}