Use our own stdout log handler

This logic used to live in our copy of log, but is not in vendored
Ethereum version.
pull/250/head
Eugene Kim 6 years ago
parent 5ad4d5a8f0
commit 6fcb627af8
  1. 2
      cmd/beaconchain/main.go
  2. 2
      cmd/client/txgen/main.go
  3. 6
      cmd/client/wallet/main.go
  4. 2
      cmd/harmony.go

@ -34,7 +34,7 @@ func main() {
printVersion(os.Args[0])
}
h := log.StdoutHandler
h := log.StreamHandler(os.Stdout, log.TerminalFormat(false))
log.Root().SetHandler(h)
bc := beaconchain.New(*numShards, *ip, *port)

@ -88,7 +88,7 @@ func main() {
// Setup a logger to stdout and log file.
logFileName := fmt.Sprintf("./%v/txgen.log", *logFolder)
h := log.MultiHandler(
log.StdoutHandler,
log.StreamHandler(os.Stdout, log.TerminalFormat(false)),
log.Must.FileHandler(logFileName, log.LogfmtFormat()), // Log to file
)
log.Root().SetHandler(h)

@ -16,13 +16,14 @@ import (
"github.com/ethereum/go-ethereum/common"
crypto2 "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"github.com/harmony-one/harmony/api/client"
clientService "github.com/harmony-one/harmony/api/client/service"
proto_node "github.com/harmony-one/harmony/api/proto/node"
"github.com/harmony-one/harmony/core/types"
libs "github.com/harmony-one/harmony/internal/beaconchain/libs"
"github.com/harmony-one/harmony/internal/beaconchain/rpc"
beaconchain "github.com/harmony-one/harmony/internal/beaconchain/rpc"
"github.com/harmony-one/harmony/node"
"github.com/harmony-one/harmony/p2p"
"github.com/harmony-one/harmony/p2p/p2pimpl"
@ -49,6 +50,9 @@ type AccountState struct {
// The main wallet program entrance. Note the this wallet program is for demo-purpose only. It does not implement
// the secure storage of keys.
func main() {
h := log.StreamHandler(os.Stdout, log.TerminalFormat(false))
log.Root().SetHandler(h)
// Account subcommands
accountImportCommand := flag.NewFlagSet("import", flag.ExitOnError)
accountImportPtr := accountImportCommand.String("privateKey", "", "Specify the private key to import")

@ -64,7 +64,7 @@ func loggingInit(logFolder, role, ip, port string, onlyLogTps bool) {
// Setup a logger to stdout and log file.
logFileName := fmt.Sprintf("./%v/%s-%v-%v.log", logFolder, role, ip, port)
h := log.MultiHandler(
log.StdoutHandler,
log.StreamHandler(os.Stdout, log.TerminalFormat(false)),
log.Must.FileHandler(logFileName, log.JSONFormat()), // Log to file
)
if onlyLogTps {

Loading…
Cancel
Save