|
|
|
@ -1,20 +1,20 @@ |
|
|
|
|
package utils |
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
|
"fmt" |
|
|
|
|
"github.com/ethereum/eth-go" |
|
|
|
|
"github.com/ethereum/eth-go/ethlog" |
|
|
|
|
"github.com/ethereum/eth-go/ethminer" |
|
|
|
|
"github.com/ethereum/eth-go/ethpub" |
|
|
|
|
"github.com/ethereum/eth-go/ethrpc" |
|
|
|
|
"github.com/ethereum/eth-go/ethutil" |
|
|
|
|
"github.com/ethereum/eth-go/ethlog" |
|
|
|
|
"log" |
|
|
|
|
"io" |
|
|
|
|
"path" |
|
|
|
|
"log" |
|
|
|
|
"os" |
|
|
|
|
"os/signal" |
|
|
|
|
"fmt" |
|
|
|
|
"time" |
|
|
|
|
"path" |
|
|
|
|
"strings" |
|
|
|
|
"time" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
var logger = ethlog.NewLogger("CLI") |
|
|
|
@ -50,7 +50,7 @@ func AbsolutePath(Datadir string, filename string) string { |
|
|
|
|
return path.Join(Datadir, filename) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func openLogFile (Datadir string, filename string) *os.File { |
|
|
|
|
func openLogFile(Datadir string, filename string) *os.File { |
|
|
|
|
path := AbsolutePath(Datadir, filename) |
|
|
|
|
file, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666) |
|
|
|
|
if err != nil { |
|
|
|
@ -59,7 +59,7 @@ func openLogFile (Datadir string, filename string) *os.File { |
|
|
|
|
return file |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func confirm (message string) bool { |
|
|
|
|
func confirm(message string) bool { |
|
|
|
|
fmt.Println(message, "Are you sure? (y/n)") |
|
|
|
|
var r string |
|
|
|
|
fmt.Scanln(&r) |
|
|
|
@ -83,7 +83,7 @@ func InitDataDir(Datadir string) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func InitLogging (Datadir string, LogFile string, LogLevel int, DebugFile string) { |
|
|
|
|
func InitLogging(Datadir string, LogFile string, LogLevel int, DebugFile string) { |
|
|
|
|
var writer io.Writer |
|
|
|
|
if LogFile == "" { |
|
|
|
|
writer = os.Stdout |
|
|
|
|