format code
This commit is contained in:
@@ -1,17 +1,15 @@
|
||||
## logs
|
||||
logs is a Go logs manager. It can use many logs adapters. The repo is inspired by `database/sql` .
|
||||
|
||||
logs is a Go logs manager. It can use many logs adapters. The repo is inspired by `database/sql` .
|
||||
|
||||
## How to install?
|
||||
|
||||
go get github.com/beego/beego/v2/logs
|
||||
|
||||
|
||||
## What adapters are supported?
|
||||
|
||||
As of now this logs support console, file,smtp and conn.
|
||||
|
||||
|
||||
## How to use it?
|
||||
|
||||
First you must import it
|
||||
|
||||
@@ -58,7 +58,7 @@ func TestConsoleAsync(t *testing.T) {
|
||||
log := NewLogger(100)
|
||||
log.SetLogger("console")
|
||||
log.Async()
|
||||
//log.Close()
|
||||
// log.Close()
|
||||
testConsoleCalls(log)
|
||||
for len(log.msgChan) != 0 {
|
||||
time.Sleep(1 * time.Millisecond)
|
||||
|
||||
@@ -164,7 +164,7 @@ func TestFileDailyRotate_05(t *testing.T) {
|
||||
testFileDailyRotate(t, fn1, fn2)
|
||||
os.Remove(fn)
|
||||
}
|
||||
func TestFileDailyRotate_06(t *testing.T) { //test file mode
|
||||
func TestFileDailyRotate_06(t *testing.T) { // test file mode
|
||||
log := NewLogger(10000)
|
||||
log.SetLogger("file", `{"filename":"test3.log","maxlines":4}`)
|
||||
log.Debug("debug")
|
||||
@@ -237,7 +237,7 @@ func TestFileHourlyRotate_05(t *testing.T) {
|
||||
os.Remove(fn)
|
||||
}
|
||||
|
||||
func TestFileHourlyRotate_06(t *testing.T) { //test file mode
|
||||
func TestFileHourlyRotate_06(t *testing.T) { // test file mode
|
||||
log := NewLogger(10000)
|
||||
log.SetLogger("file", `{"filename":"test3.log", "hourly":true, "maxlines":4}`)
|
||||
log.Debug("debug")
|
||||
|
||||
@@ -60,7 +60,7 @@ func formatTimeHeader(when time.Time) ([]byte, int, int) {
|
||||
y, mo, d := when.Date()
|
||||
h, mi, s := when.Clock()
|
||||
ns := when.Nanosecond() / 1000000
|
||||
//len("2006/01/02 15:04:05.123 ")==24
|
||||
// len("2006/01/02 15:04:05.123 ")==24
|
||||
var buf [24]byte
|
||||
|
||||
buf[0] = y1[y/1000%10]
|
||||
@@ -126,12 +126,12 @@ func initColor() {
|
||||
cyan = w32Cyan
|
||||
}
|
||||
colorMap = map[string]string{
|
||||
//by color
|
||||
// by color
|
||||
"green": green,
|
||||
"white": white,
|
||||
"yellow": yellow,
|
||||
"red": red,
|
||||
//by method
|
||||
// by method
|
||||
"GET": blue,
|
||||
"POST": cyan,
|
||||
"PUT": yellow,
|
||||
|
||||
@@ -188,10 +188,10 @@ func (e *Email) Attach(r io.Reader, filename string, args ...string) (a *Attachm
|
||||
err = errors.New("Must specify the file type and number of parameters can not exceed at least two")
|
||||
return
|
||||
}
|
||||
c := args[0] //Content-Type
|
||||
c := args[0] // Content-Type
|
||||
id := ""
|
||||
if len(args) > 1 {
|
||||
id = args[1] //Content-ID
|
||||
id = args[1] // Content-ID
|
||||
}
|
||||
var buffer bytes.Buffer
|
||||
if _, err = io.Copy(&buffer, r); err != nil {
|
||||
|
||||
@@ -141,7 +141,6 @@ Struct Tag Functions:
|
||||
Phone
|
||||
ZipCode
|
||||
|
||||
|
||||
## LICENSE
|
||||
|
||||
BSD License http://creativecommons.org/licenses/BSD/
|
||||
|
||||
@@ -423,7 +423,7 @@ func (v *Validation) Valid(obj interface{}) (b bool, err error) {
|
||||
// Step2: If pass on step1, then reflect obj's fields
|
||||
// Step3: Do the Recursively validation to all struct or struct pointer fields
|
||||
func (v *Validation) RecursiveValid(objc interface{}) (bool, error) {
|
||||
//Step 1: validate obj itself firstly
|
||||
// Step 1: validate obj itself firstly
|
||||
// fails if objc is not struct
|
||||
pass, err := v.Valid(objc)
|
||||
if err != nil || !pass {
|
||||
|
||||
Reference in New Issue
Block a user