improve gcfg

This commit is contained in:
John
2020-02-14 21:57:35 +08:00
parent cfdd043e4e
commit 19755ad233
2 changed files with 4 additions and 0 deletions

View File

@ -11,6 +11,7 @@ import (
"bytes"
"errors"
"fmt"
"github.com/gogf/gf/text/gstr"
"github.com/gogf/gf/os/gres"
@ -93,6 +94,7 @@ func (c *Config) filePath(file ...string) (path string) {
c.paths.RLockFunc(func(array []string) {
index := 1
for _, v := range array {
v = gstr.TrimRight(v, `\/`)
buffer.WriteString(fmt.Sprintf("\n%d. %s", index, v))
index++
buffer.WriteString(fmt.Sprintf("\n%d. %s", index, v+gfile.Separator+"config"))
@ -274,6 +276,7 @@ func (c *Config) FilePath(file ...string) (path string) {
// Searching the file system.
c.paths.RLockFunc(func(array []string) {
for _, prefix := range array {
prefix = gstr.TrimRight(prefix, `\/`)
if path, _ = gspath.Search(prefix, name); path != "" {
return
}

View File

@ -24,6 +24,7 @@ import (
"github.com/gogf/gf/util/gconv"
)
// Logger is the struct for logging management.
type Logger struct {
parent *Logger // Parent logger.
config Config // Logger configuration.