本文整理匯總了Golang中github.com/ethereum/go-ethereum/logger.NewLogger函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewLogger函數的具體用法?Golang NewLogger怎麽用?Golang NewLogger使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了NewLogger函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/pow"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/trie"
"github.com/hashicorp/golang-lru"
)
var (
chainlogger = logger.NewLogger("CHAIN")
jsonlogger = logger.NewJsonLogger()
blockInsertTimer = metrics.NewTimer("chain/inserts")
ErrNoGenesis = errors.New("Genesis not found in chain")
)
const (
headerCacheLimit = 512
bodyCacheLimit = 256
tdCacheLimit = 1024
blockCacheLimit = 256
maxFutureBlocks = 256
maxTimeFutureBlocks = 30
)
示例2:
"runtime"
"sort"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/ui/qt/qwhisper"
"github.com/ethereum/go-ethereum/xeth"
"github.com/obscuren/qml"
)
var guilogger = logger.NewLogger("GUI")
type ServEv byte
const (
setup ServEv = iota
update
)
type Gui struct {
// The main application window
win *qml.Window
// QML Engine
engine *qml.Engine
component *qml.Common
// The ethereum interface
示例3: NewWhisper
// Contains the external API to the whisper sub-protocol.
package xeth
import (
"fmt"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/whisper"
)
var qlogger = logger.NewLogger("XSHH")
// Whisper represents the API wrapper around the internal whisper implementation.
type Whisper struct {
*whisper.Whisper
}
// NewWhisper wraps an internal whisper client into an external API version.
func NewWhisper(w *whisper.Whisper) *Whisper {
return &Whisper{w}
}
// NewIdentity generates a new cryptographic identity for the client, and injects
// it into the known identities for message decryption.
func (self *Whisper) NewIdentity() string {
identity := self.Whisper.NewIdentity()
return common.ToHex(crypto.FromECDSAPub(&identity.PublicKey))
示例4: Find
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package dagger
import (
"hash"
"math/big"
"math/rand"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto/sha3"
"github.com/ethereum/go-ethereum/logger"
)
var powlogger = logger.NewLogger("POW")
type Dagger struct {
hash *big.Int
xn *big.Int
}
var Found bool
func (dag *Dagger) Find(obj *big.Int, resChan chan int64) {
r := rand.New(rand.NewSource(time.Now().UnixNano()))
for i := 0; i < 1000; i++ {
rnd := r.Int63()
res := dag.Eval(big.NewInt(rnd))
示例5:
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/pow"
"github.com/ethereum/go-ethereum/rlp"
"gopkg.in/fatih/set.v0"
)
const (
// must be bumped when consensus algorithm is changed, this forces the upgradedb
// command to be run (forces the blocks to be imported again using the new algorithm)
BlockChainVersion = 2
)
var statelogger = logger.NewLogger("BLOCK")
type BlockProcessor struct {
db common.Database
extraDb common.Database
// Mutex for locking the block processor. Blocks can only be handled one at a time
mutex sync.Mutex
// Canonical block chain
bc *ChainManager
// non-persistent key/value memory storage
mem map[string]*big.Int
// Proof of work used for validating
Pow pow.PoW
txpool *TxPool
示例6: init
"os"
"runtime"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/logger"
)
const (
Version = "0.0.2"
)
var (
clilogger = logger.NewLogger("Parser")
app = utils.NewApp(Version, "Ethereum chain parser")
)
func init() {
app.Action = run
app.Name = "BlockParser"
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "mongo-url",
Value: "mongodb://localhost",
Usage: "MongoDB connection url",
},
cli.StringFlag{
Name: "mongo-database",
Value: "chain_explorer",
示例7: New
// QWhisper package. This package is temporarily on hold until QML DApp dev will reemerge.
package qwhisper
import (
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/whisper"
"github.com/obscuren/qml"
)
var qlogger = logger.NewLogger("QSHH")
type Whisper struct {
*whisper.Whisper
view qml.Object
watches map[int]*Watch
}
func New(w *whisper.Whisper) *Whisper {
return &Whisper{w, nil, make(map[int]*Watch)}
}
func (self *Whisper) SetView(view qml.Object) {
self.view = view
}
func (self *Whisper) Post(payload []string, to, from string, topics []string, priority, ttl uint32) {
示例8: init
package helper
import (
"log"
"os"
logpkg "github.com/ethereum/go-ethereum/logger"
)
var Logger *logpkg.StdLogSystem
var Log = logpkg.NewLogger("TEST")
func init() {
Logger = logpkg.NewStdLogSystem(os.Stdout, log.LstdFlags, logpkg.InfoLevel)
logpkg.AddLogSystem(Logger)
}