mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-01 00:31:21 +00:00
07ffa36d44
- lives in internal/logging - all log flags moved to internal/logging/flags - allows continued use of root logger via log.Info etc. - update logger to take change allowing string to lvl for 'trace' Verbosity flag is overridden by log.console.verbosity. Logs will be colocated if all run as one process, only split where progs are run as separate processes, in a future update this will be addressed so for example rpcdeamon will always log to it's own file
44 lines
1.1 KiB
Go
44 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/ledgerwatch/erigon-lib/common"
|
|
"github.com/ledgerwatch/erigon/cmd/rpcdaemon/cli"
|
|
"github.com/ledgerwatch/erigon/cmd/rpcdaemon/commands"
|
|
"github.com/ledgerwatch/erigon/internal/logging"
|
|
"github.com/ledgerwatch/log/v3"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func main() {
|
|
cmd, cfg := cli.RootCommand()
|
|
rootCtx, rootCancel := common.RootContext()
|
|
cmd.RunE = func(cmd *cobra.Command, args []string) error {
|
|
ctx := cmd.Context()
|
|
logger := logging.GetLoggerCmd("rpcdaemon", cmd)
|
|
db, borDb, backend, txPool, mining, stateCache, blockReader, ff, agg, err := cli.RemoteServices(ctx, *cfg, logger, rootCancel)
|
|
if err != nil {
|
|
log.Error("Could not connect to DB", "err", err)
|
|
return nil
|
|
}
|
|
defer db.Close()
|
|
if borDb != nil {
|
|
defer borDb.Close()
|
|
}
|
|
|
|
apiList := commands.APIList(db, borDb, backend, txPool, mining, ff, stateCache, blockReader, agg, *cfg)
|
|
if err := cli.StartRpcServer(ctx, *cfg, apiList, nil); err != nil {
|
|
log.Error(err.Error())
|
|
return nil
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
if err := cmd.ExecuteContext(rootCtx); err != nil {
|
|
log.Error(err.Error())
|
|
os.Exit(1)
|
|
}
|
|
}
|