mirror of
https://github.com/kopia/kopia.git
synced 2026-01-25 06:48:48 -05:00
This is mostly mechanical and changes how loggers are instantiated. Logger is now associated with a context, passed around all methods, (most methods had ctx, but had to add it in a few missing places). By default Kopia does not produce any logs, but it can be overridden, either locally for a nested context, by calling ctx = logging.WithLogger(ctx, newLoggerFunc) To override logs globally, call logging.SetDefaultLogger(newLoggerFunc) This refactoring allowed removing dependency from Kopia repo and go-logging library (the CLI still uses it, though). It is now also possible to have all test methods emit logs using t.Logf() so that they show up in failure reports, which should make debugging of test failures suck less.
20 lines
427 B
Go
20 lines
427 B
Go
package cli
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/kopia/kopia/internal/serverapi"
|
|
)
|
|
|
|
var (
|
|
serverFlushCommand = serverCommands.Command("flush", "Flush the state of Kopia server to persistent storage, etc.")
|
|
)
|
|
|
|
func init() {
|
|
serverFlushCommand.Action(serverAction(runServerFlush))
|
|
}
|
|
|
|
func runServerFlush(ctx context.Context, cli *serverapi.Client) error {
|
|
return cli.Post(ctx, "flush", &serverapi.Empty{}, &serverapi.Empty{})
|
|
}
|