feat!: Provide logger through depinject (#15818)
Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
co-authored by
Julien Robert
parent
8e896f4d31
commit
af3122aa6c
@@ -6,6 +6,8 @@ import (
|
||||
|
||||
runtimev1alpha1 "cosmossdk.io/api/cosmos/app/runtime/v1alpha1"
|
||||
appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1"
|
||||
"cosmossdk.io/log"
|
||||
|
||||
storetypes "cosmossdk.io/store/types"
|
||||
abci "github.com/cometbft/cometbft/abci/types"
|
||||
"golang.org/x/exp/slices"
|
||||
@@ -47,6 +49,7 @@ type App struct {
|
||||
baseAppOptions []BaseAppOption
|
||||
msgServiceRouter *baseapp.MsgServiceRouter
|
||||
appConfig *appv1alpha1.Config
|
||||
logger log.Logger
|
||||
// initChainer is the init chainer function defined by the app config.
|
||||
// this is only required if the chain wants to add special InitChainer logic.
|
||||
initChainer sdk.InitChainer
|
||||
|
||||
+1
-3
@@ -4,7 +4,6 @@ import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
|
||||
"cosmossdk.io/log"
|
||||
dbm "github.com/cosmos/cosmos-db"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/baseapp"
|
||||
@@ -26,7 +25,6 @@ func (a *AppBuilder) DefaultGenesis() map[string]json.RawMessage {
|
||||
|
||||
// Build builds an *App instance.
|
||||
func (a *AppBuilder) Build(
|
||||
logger log.Logger,
|
||||
db dbm.DB,
|
||||
traceStore io.Writer,
|
||||
baseAppOptions ...func(*baseapp.BaseApp),
|
||||
@@ -35,7 +33,7 @@ func (a *AppBuilder) Build(
|
||||
baseAppOptions = append(baseAppOptions, option)
|
||||
}
|
||||
|
||||
bApp := baseapp.NewBaseApp(a.app.config.AppName, logger, db, nil, baseAppOptions...)
|
||||
bApp := baseapp.NewBaseApp(a.app.config.AppName, a.app.logger, db, nil, baseAppOptions...)
|
||||
bApp.SetMsgServiceRouter(a.app.msgServiceRouter)
|
||||
bApp.SetCommitMultiStoreTracer(traceStore)
|
||||
bApp.SetVersion(version.Version)
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"os"
|
||||
|
||||
"cosmossdk.io/core/store"
|
||||
"cosmossdk.io/log"
|
||||
"github.com/cosmos/gogoproto/proto"
|
||||
"google.golang.org/protobuf/reflect/protodesc"
|
||||
"google.golang.org/protobuf/reflect/protoregistry"
|
||||
@@ -127,6 +128,7 @@ type AppInputs struct {
|
||||
BaseAppOptions []BaseAppOption
|
||||
InterfaceRegistry codectypes.InterfaceRegistry
|
||||
LegacyAmino *codec.LegacyAmino
|
||||
Logger log.Logger
|
||||
}
|
||||
|
||||
func SetupAppBuilder(inputs AppInputs) {
|
||||
@@ -135,6 +137,7 @@ func SetupAppBuilder(inputs AppInputs) {
|
||||
app.config = inputs.Config
|
||||
app.ModuleManager = module.NewManagerFromMap(inputs.Modules)
|
||||
app.appConfig = inputs.AppConfig
|
||||
app.logger = inputs.Logger
|
||||
|
||||
for name, mod := range inputs.Modules {
|
||||
if basicMod, ok := mod.(module.AppModuleBasic); ok {
|
||||
|
||||
Reference in New Issue
Block a user