kubo/plugin/plugins/fxtest/fxtest.go
Andrew Gillis 20d9660a64
Some checks are pending
CodeQL / codeql (push) Waiting to run
Docker Build / docker-build (push) Waiting to run
Gateway Conformance / gateway-conformance (push) Waiting to run
Gateway Conformance / gateway-conformance-libp2p-experiment (push) Waiting to run
Go Build / go-build (push) Waiting to run
Go Check / go-check (push) Waiting to run
Go Lint / go-lint (push) Waiting to run
Go Test / go-test (push) Waiting to run
Interop / interop-prep (push) Waiting to run
Interop / helia-interop (push) Blocked by required conditions
Interop / ipfs-webui (push) Blocked by required conditions
Sharness / sharness-test (push) Waiting to run
Spell Check / spellcheck (push) Waiting to run
chore: use go-log/v2 (#10801)
* chore: update to go-log/v2

go-log v2 has been out for quite a while now and it is time to deprecate v1.

Replace all use of go-log with go-log/v2
Makes /api/v0/log/tail useful over HTTP
Updates dependencies that have moved to go-lov/v2
Removes support for ContextWithLoggable as this is not needed for tracing-like functionality
- Replaces: PR #8765
- Closes issue #8753
- Closes issue #9245
- Closes issue #10809

Other fixes:
* update go-ipfs-cmds
* update http logs test
* fix test
* Read/send one line of log data at a time
* Update -log-level docs
2025-05-19 13:04:05 -07:00

45 lines
918 B
Go

package fxtest
import (
"os"
logging "github.com/ipfs/go-log/v2"
"github.com/ipfs/kubo/core"
"github.com/ipfs/kubo/plugin"
"go.uber.org/fx"
)
var log = logging.Logger("fxtestplugin")
var Plugins = []plugin.Plugin{
&fxtestPlugin{},
}
// fxtestPlugin is used for testing the fx plugin.
// It merely adds an fx option that logs a debug statement, so we can verify that it works in tests.
type fxtestPlugin struct{}
var _ plugin.PluginFx = (*fxtestPlugin)(nil)
func (p *fxtestPlugin) Name() string {
return "fx-test"
}
func (p *fxtestPlugin) Version() string {
return "0.1.0"
}
func (p *fxtestPlugin) Init(env *plugin.Environment) error {
return nil
}
func (p *fxtestPlugin) Options(info core.FXNodeInfo) ([]fx.Option, error) {
opts := info.FXOptions
if os.Getenv("TEST_FX_PLUGIN") != "" {
opts = append(opts, fx.Invoke(func() {
log.Debug("invoked test fx function")
}))
}
return opts, nil
}