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