当前位置: 首页>>代码示例>>Golang>>正文


Golang logger.NewLogger函数代码示例

本文整理汇总了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
)
开发者ID:General-Beck,项目名称:go-ethereum,代码行数:31,代码来源:blockchain.go

示例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
开发者ID:CedarLogic,项目名称:go-ethereum,代码行数:31,代码来源:gui.go

示例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))
开发者ID:CedarLogic,项目名称:go-ethereum,代码行数:31,代码来源:whisper.go

示例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))
开发者ID:Raskal8,项目名称:go-ethereum,代码行数:31,代码来源:dagger.go

示例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
开发者ID:CedarLogic,项目名称:go-ethereum,代码行数:30,代码来源:block_processor.go

示例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",
开发者ID:gerrit-rws,项目名称:ecp,代码行数:31,代码来源:main.go

示例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) {
开发者ID:CedarLogic,项目名称:go-ethereum,代码行数:31,代码来源:whisper.go

示例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)
}
开发者ID:CedarLogic,项目名称:go-ethereum,代码行数:16,代码来源:init.go


注:本文中的github.com/ethereum/go-ethereum/logger.NewLogger函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。