2019-10-24 23:07:07 +00:00
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2022-03-17 00:33:59 +00:00
|
|
|
"github.com/stashapp/stash/internal/manager"
|
2019-10-24 23:07:07 +00:00
|
|
|
)
|
|
|
|
|
2022-04-25 05:55:05 +00:00
|
|
|
func (r *queryResolver) Logs(ctx context.Context) ([]*LogEntry, error) {
|
2022-03-17 00:33:59 +00:00
|
|
|
logger := manager.GetInstance().Logger
|
2019-10-24 23:07:07 +00:00
|
|
|
logCache := logger.GetLogCache()
|
2022-04-25 05:55:05 +00:00
|
|
|
ret := make([]*LogEntry, len(logCache))
|
2019-10-24 23:07:07 +00:00
|
|
|
|
|
|
|
for i, entry := range logCache {
|
2022-04-25 05:55:05 +00:00
|
|
|
ret[i] = &LogEntry{
|
2019-10-24 23:07:07 +00:00
|
|
|
Time: entry.Time,
|
|
|
|
Level: getLogLevel(entry.Type),
|
|
|
|
Message: entry.Message,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret, nil
|
2020-01-31 22:19:15 +00:00
|
|
|
}
|