mirror of
https://github.com/datarhei/core.git
synced 2025-10-04 15:42:57 +08:00

Commits (Ingo Oppermann): - Add experimental SRT connection stats and logs - Hide /config/reload endpoint in reade-only mode - Add SRT server - Create v16 in go.mod - Fix data races, tests, lint, and update dependencies - Add trailing slash for routed directories (datarhei/restreamer#340) - Allow relative URLs in content in static routes Co-Authored-By: Ingo Oppermann <57445+ioppermann@users.noreply.github.com>
30 lines
643 B
Go
30 lines
643 B
Go
package resolver
|
|
|
|
// This file will be automatically regenerated based on the schema, any resolver implementations
|
|
// will be copied through when generating and any unknown code will be moved to the end.
|
|
|
|
import (
|
|
"context"
|
|
"strings"
|
|
|
|
"github.com/datarhei/core/v16/log"
|
|
)
|
|
|
|
func (r *queryResolver) Log(ctx context.Context) ([]string, error) {
|
|
if r.LogBuffer == nil {
|
|
r.LogBuffer = log.NewBufferWriter(log.Lsilent, 1)
|
|
}
|
|
|
|
events := r.LogBuffer.Events()
|
|
|
|
formatter := log.NewConsoleFormatter(false)
|
|
|
|
log := make([]string, len(events))
|
|
|
|
for i, e := range events {
|
|
log[i] = strings.TrimSpace(formatter.String(e))
|
|
}
|
|
|
|
return log, nil
|
|
}
|