charts, client, common, container, genesis, k8s, log: logger refactoing for correct caller line number

This commit is contained in:
Alan Chen 2017-09-12 15:25:18 +08:00
parent 2950c03765
commit d6ea5008a2
22 changed files with 138 additions and 41 deletions

View File

@ -25,7 +25,6 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/getamis/istanbul-tools/genesis"
"github.com/getamis/istanbul-tools/log"
)
type GenesisChart struct {

23
charts/log.go Normal file
View File

@ -0,0 +1,23 @@
// Copyright 2017 AMIS Technologies
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package charts
import (
logging "github.com/getamis/istanbul-tools/log"
)
var log = logging.New()

View File

@ -23,7 +23,6 @@ import (
"strings"
"github.com/getamis/istanbul-tools/common"
"github.com/getamis/istanbul-tools/log"
)
type StaticNodesChart struct {

View File

@ -20,8 +20,6 @@ import (
"context"
"github.com/ethereum/go-ethereum/common"
"github.com/getamis/istanbul-tools/log"
)
func ExampleStartMining() {

23
client/log.go Normal file
View File

@ -0,0 +1,23 @@
// Copyright 2017 AMIS Technologies
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package client
import (
logging "github.com/getamis/istanbul-tools/log"
)
var log = logging.New()

23
common/log.go Normal file
View File

@ -0,0 +1,23 @@
// Copyright 2017 AMIS Technologies
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package common
import (
logging "github.com/getamis/istanbul-tools/log"
)
var log = logging.New()

View File

@ -31,8 +31,6 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/p2p/discover"
uuid "github.com/satori/go.uuid"
"github.com/getamis/istanbul-tools/log"
)
const (

View File

@ -35,7 +35,6 @@ import (
istcommon "github.com/getamis/istanbul-tools/common"
"github.com/getamis/istanbul-tools/genesis"
"github.com/getamis/istanbul-tools/log"
)
const (

View File

@ -34,7 +34,6 @@ import (
"github.com/docker/go-connections/nat"
"github.com/getamis/istanbul-tools/common"
"github.com/getamis/istanbul-tools/log"
)
//TODO: refactor this with ethereum options?

View File

@ -22,8 +22,6 @@ import (
"os"
"github.com/docker/docker/client"
"github.com/getamis/istanbul-tools/log"
)
func (eth *ethereum) Image() string {

View File

@ -45,7 +45,6 @@ import (
"github.com/getamis/istanbul-tools/client"
istcommon "github.com/getamis/istanbul-tools/common"
"github.com/getamis/istanbul-tools/genesis"
"github.com/getamis/istanbul-tools/log"
)
const (

23
container/log.go Normal file
View File

@ -0,0 +1,23 @@
// Copyright 2017 AMIS Technologies
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package container
import (
logging "github.com/getamis/istanbul-tools/log"
)
var log = logging.New()

View File

@ -26,8 +26,6 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/client"
"github.com/getamis/istanbul-tools/log"
)
const (

View File

@ -31,7 +31,6 @@ import (
"github.com/ethereum/go-ethereum/params"
"github.com/getamis/istanbul-tools/common"
"github.com/getamis/istanbul-tools/log"
)
const (

23
genesis/log.go Normal file
View File

@ -0,0 +1,23 @@
// Copyright 2017 AMIS Technologies
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package genesis
import (
logging "github.com/getamis/istanbul-tools/log"
)
var log = logging.New()

View File

@ -24,7 +24,6 @@ import (
"github.com/ethereum/go-ethereum/core"
"github.com/getamis/istanbul-tools/cmd/istanbul/extra"
"github.com/getamis/istanbul-tools/log"
)
type Option func(*core.Genesis)

View File

@ -24,7 +24,6 @@ import (
"github.com/getamis/istanbul-tools/charts"
istcommon "github.com/getamis/istanbul-tools/common"
"github.com/getamis/istanbul-tools/container"
"github.com/getamis/istanbul-tools/log"
)
func NewBlockchain(numOfValidators int, gaslimit uint64, options ...Option) (bc *blockchain) {

View File

@ -18,8 +18,6 @@ package k8s
import (
"time"
"github.com/getamis/istanbul-tools/log"
)
func ExampleK8SBlockchain() {

View File

@ -20,7 +20,6 @@ import (
"github.com/getamis/istanbul-tools/charts"
"github.com/getamis/istanbul-tools/common"
"github.com/getamis/istanbul-tools/genesis"
"github.com/getamis/istanbul-tools/log"
)
func ExampleK8SEthereum() {

23
k8s/log.go Normal file
View File

@ -0,0 +1,23 @@
// Copyright 2017 AMIS Technologies
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package k8s
import (
logging "github.com/getamis/istanbul-tools/log"
)
var log = logging.New()

View File

@ -25,8 +25,6 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
"github.com/getamis/istanbul-tools/log"
)
const (

View File

@ -37,23 +37,3 @@ func init() {
func New(ctx ...interface{}) log15.Logger {
return defaultLogger.New(ctx...)
}
func Info(msg string, ctx ...interface{}) {
defaultLogger.Info(msg, ctx...)
}
func Debug(msg string, ctx ...interface{}) {
defaultLogger.Debug(msg, ctx...)
}
func Warn(msg string, ctx ...interface{}) {
defaultLogger.Warn(msg, ctx)
}
func Error(msg string, ctx ...interface{}) {
defaultLogger.Error(msg, ctx...)
}
func Fatal(msg string, ctx ...interface{}) {
defaultLogger.Crit(msg, ctx...)
}