-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
68 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
// Package termlog 统一的终端日志类型 | ||
package termlog | ||
|
||
import ( | ||
"io" | ||
|
||
"github.com/issue9/localeutil" | ||
"github.com/issue9/web/logs" | ||
) | ||
|
||
// New 声明用于终端输出的日志 | ||
// | ||
// 如果初始化时出错,则会直接 Panic。 | ||
func New(p *localeutil.Printer, out io.Writer) logs.Logs { | ||
log, err := logs.New(p, &logs.Options{ | ||
Levels: logs.AllLevels(), | ||
Handler: logs.NewTermHandler(out, nil), | ||
Created: logs.NanoLayout, | ||
}) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
return log | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
package termlog | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/issue9/assert/v3" | ||
"golang.org/x/text/language" | ||
"golang.org/x/text/message" | ||
) | ||
|
||
func TestNew(t *testing.T) { | ||
a := assert.New(t, false) | ||
a.NotNil(New(nil, os.Stdout)) | ||
a.NotNil(New(message.NewPrinter(language.SimplifiedChinese), os.Stdout)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ import ( | |
) | ||
|
||
// Version 当前框架的版本 | ||
const Version = "0.86.0" | ||
const Version = "0.86.2" | ||
|
||
// 服务的几种状态 | ||
const ( | ||
|