dashboard, log: gosimple

This commit is contained in:
Kurkó Mihály 2018-07-04 21:43:58 +03:00
parent 64af3ef1e2
commit 0f93200c00
2 changed files with 3 additions and 3 deletions

View file

@ -62,7 +62,7 @@ func (db *Dashboard) handleLogRequest(r *LogsRequest, c *client) {
log.Warn("Failed to open logdir", "path", db.logdir, "err", err)
return
}
re := regexp.MustCompile("\\.log$")
re := regexp.MustCompile(`\.log$`)
fileNames := make([]string, 0, len(files))
for _, f := range files {
if f.Mode().IsRegular() && re.MatchString(f.Name()) {
@ -155,7 +155,7 @@ func (db *Dashboard) streamLogs() {
)
// The log records are always written into the last file in alphabetical order, because of the timestamp.
re := regexp.MustCompile("\\.log$")
re := regexp.MustCompile(`\.log$`)
i := len(files) - 1
for i >= 0 && (!files[i].Mode().IsRegular() || !re.MatchString(files[i].Name())) {
i--

View file

@ -142,7 +142,7 @@ func RotatingFileHandler(path string, limit uint, formatter Format) (Handler, er
if err != nil {
return nil, err
}
re := regexp.MustCompile("\\.log$")
re := regexp.MustCompile(`\.log$`)
last := len(files) - 1
for last >= 0 && (!files[last].Mode().IsRegular() || !re.MatchString(files[last].Name())) {
last--