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


Golang 0.Logger函数代码示例

本文整理汇总了Golang中github.com/djbarber/ipfs-hack/vendor/go-log-v1/0/0.Logger函数的典型用法代码示例。如果您正苦于以下问题:Golang Logger函数的具体用法?Golang Logger怎么用?Golang Logger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Logger函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1:

	context "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/golang.org/x/net/context"
	cmds "github.com/djbarber/ipfs-hack/commands"
	cmdsCli "github.com/djbarber/ipfs-hack/commands/cli"
	cmdsHttp "github.com/djbarber/ipfs-hack/commands/http"
	core "github.com/djbarber/ipfs-hack/core"
	coreCmds "github.com/djbarber/ipfs-hack/core/commands"
	repo "github.com/djbarber/ipfs-hack/repo"
	config "github.com/djbarber/ipfs-hack/repo/config"
	fsrepo "github.com/djbarber/ipfs-hack/repo/fsrepo"
	u "github.com/djbarber/ipfs-hack/util"
	logging "github.com/djbarber/ipfs-hack/vendor/go-log-v1.0.0"
)

// log is the command logger
var log = logging.Logger("cmd/ipfs")

var (
	errUnexpectedApiOutput = errors.New("api returned unexpected output")
	errApiVersionMismatch  = errors.New("api version mismatch")
)

const (
	EnvEnableProfiling = "IPFS_PROF"
	cpuProfile         = "ipfs.cpuprof"
	heapProfile        = "ipfs.memprof"
	errorFormat        = "ERROR: %v\n\n"
)

type cmdInvocation struct {
	path []string
开发者ID:djbarber,项目名称:ipfs-hack,代码行数:30,代码来源:main.go

示例2: ReleaseBuffer

	"net"
	"time"

	msgio "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/github.com/jbenet/go-msgio"
	mpool "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/github.com/jbenet/go-msgio/mpool"
	ma "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
	manet "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/github.com/jbenet/go-multiaddr-net"
	context "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/golang.org/x/net/context"
	ic "github.com/djbarber/ipfs-hack/p2p/crypto"
	peer "github.com/djbarber/ipfs-hack/p2p/peer"
	u "github.com/djbarber/ipfs-hack/util"
	lgbl "github.com/djbarber/ipfs-hack/util/eventlog/loggables"
	logging "github.com/djbarber/ipfs-hack/vendor/go-log-v1.0.0"
)

var log = logging.Logger("conn")

// ReleaseBuffer puts the given byte array back into the buffer pool,
// first verifying that it is the correct size
func ReleaseBuffer(b []byte) {
	log.Debugf("Releasing buffer! (cap,size = %d, %d)", cap(b), len(b))
	mpool.ByteSlicePool.Put(uint32(cap(b)), b)
}

// singleConn represents a single connection to another Peer (IPFS Node).
type singleConn struct {
	local  peer.ID
	remote peer.ID
	maconn manet.Conn
	msgrw  msgio.ReadWriteCloser
	event  io.Closer
开发者ID:djbarber,项目名称:ipfs-hack,代码行数:31,代码来源:conn.go

示例3: init

	addrutil "github.com/djbarber/ipfs-hack/p2p/net/swarm/addr"
	peer "github.com/djbarber/ipfs-hack/p2p/peer"
	logging "github.com/djbarber/ipfs-hack/vendor/go-log-v1.0.0"

	ma "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
	ps "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/github.com/jbenet/go-peerstream"
	pst "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/github.com/jbenet/go-stream-muxer"
	psy "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/github.com/jbenet/go-stream-muxer/yamux"
	"github.com/djbarber/ipfs-hack/Godeps/_workspace/src/github.com/jbenet/goprocess"
	goprocessctx "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/github.com/jbenet/goprocess/context"
	prom "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/github.com/prometheus/client_golang/prometheus"
	mafilter "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/github.com/whyrusleeping/multiaddr-filter"
	context "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/golang.org/x/net/context"
)

var log = logging.Logger("swarm2")

var PSTransport pst.Transport

var peersTotal = prom.NewGaugeVec(prom.GaugeOpts{
	Namespace: "ipfs",
	Subsystem: "p2p",
	Name:      "peers_total",
	Help:      "Number of connected peers",
}, []string{"peer_id"})

func init() {
	tpt := *psy.DefaultTransport
	tpt.MaxStreamWindowSize = 512 * 1024
	PSTransport = &tpt
}
开发者ID:djbarber,项目名称:ipfs-hack,代码行数:31,代码来源:swarm.go

示例4: makeHandler

package corehttp

import (
	"fmt"
	"net"
	"net/http"
	"time"

	ma "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
	manet "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/github.com/jbenet/go-multiaddr-net"
	"github.com/djbarber/ipfs-hack/Godeps/_workspace/src/github.com/jbenet/goprocess"
	core "github.com/djbarber/ipfs-hack/core"
	logging "github.com/djbarber/ipfs-hack/vendor/go-log-v1.0.0"
)

var log = logging.Logger("core/server")

// ServeOption registers any HTTP handlers it provides on the given mux.
// It returns the mux to expose to future options, which may be a new mux if it
// is interested in mediating requests to future options, or the same mux
// initially passed in if not.
type ServeOption func(*core.IpfsNode, net.Listener, *http.ServeMux) (*http.ServeMux, error)

// makeHandler turns a list of ServeOptions into a http.Handler that implements
// all of the given options, in order.
func makeHandler(n *core.IpfsNode, l net.Listener, options ...ServeOption) (http.Handler, error) {
	topMux := http.NewServeMux()
	mux := topMux
	for _, option := range options {
		var err error
		mux, err = option(n, l, mux)
开发者ID:djbarber,项目名称:ipfs-hack,代码行数:31,代码来源:corehttp.go

示例5: BuildDagFromFile

import (
	"fmt"
	"os"

	"github.com/djbarber/ipfs-hack/commands/files"
	bal "github.com/djbarber/ipfs-hack/importer/balanced"
	"github.com/djbarber/ipfs-hack/importer/chunk"
	h "github.com/djbarber/ipfs-hack/importer/helpers"
	trickle "github.com/djbarber/ipfs-hack/importer/trickle"
	dag "github.com/djbarber/ipfs-hack/merkledag"
	"github.com/djbarber/ipfs-hack/pin"
	logging "github.com/djbarber/ipfs-hack/vendor/go-log-v1.0.0"
)

var log = logging.Logger("importer")

// Builds a DAG from the given file, writing created blocks to disk as they are
// created
func BuildDagFromFile(fpath string, ds dag.DAGService, mp pin.ManualPinner) (*dag.Node, error) {
	stat, err := os.Lstat(fpath)
	if err != nil {
		return nil, err
	}

	if stat.IsDir() {
		return nil, fmt.Errorf("`%s` is a directory", fpath)
	}

	f, err := files.NewSerialFile(fpath, fpath, stat)
	if err != nil {
开发者ID:djbarber,项目名称:ipfs-hack,代码行数:30,代码来源:importer.go

示例6: Verify

import (
	"bytes"
	"io"
	"testing"

	u "github.com/djbarber/ipfs-hack/util"
	testutil "github.com/djbarber/ipfs-hack/util/testutil"
	logging "github.com/djbarber/ipfs-hack/vendor/go-log-v1.0.0"

	ic "github.com/djbarber/ipfs-hack/p2p/crypto"
	peer "github.com/djbarber/ipfs-hack/p2p/peer"

	ma "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
)

var log = logging.Logger("boguskey")

// TestBogusPrivateKey is a key used for testing (to avoid expensive keygen)
type TestBogusPrivateKey []byte

// TestBogusPublicKey is a key used for testing (to avoid expensive keygen)
type TestBogusPublicKey []byte

func (pk TestBogusPublicKey) Verify(data, sig []byte) (bool, error) {
	log.Errorf("TestBogusPublicKey.Verify -- this better be a test!")
	return bytes.Equal(data, reverse(sig)), nil
}

func (pk TestBogusPublicKey) Bytes() ([]byte, error) {
	return []byte(pk), nil
}
开发者ID:djbarber,项目名称:ipfs-hack,代码行数:31,代码来源:key.go

示例7: LessThan

package tour

import (
	"strconv"
	"strings"

	logging "github.com/djbarber/ipfs-hack/vendor/go-log-v1.0.0"
)

var log = logging.Logger("tour")

// ID is a string identifier for topics
type ID string

// LessThan returns whether this ID is sorted earlier than another.
func (i ID) LessThan(o ID) bool {
	return compareDottedInts(string(i), string(o))
}

// IDSlice implements the sort interface for ID slices.
type IDSlice []ID

func (a IDSlice) Len() int           { return len(a) }
func (a IDSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a IDSlice) Less(i, j int) bool { return a[i].LessThan(a[j]) }

// Topic is a type of objects that structures a tour topic.
type Topic struct {
	ID ID
	Content
}
开发者ID:djbarber,项目名称:ipfs-hack,代码行数:31,代码来源:tour.go

示例8: WithNPeers

package mocknet

import (
	logging "github.com/djbarber/ipfs-hack/vendor/go-log-v1.0.0"

	context "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/golang.org/x/net/context"
)

var log = logging.Logger("mocknet")

// WithNPeers constructs a Mocknet with N peers.
func WithNPeers(ctx context.Context, n int) (Mocknet, error) {
	m := New(ctx)
	for i := 0; i < n; i++ {
		if _, err := m.GenPeer(); err != nil {
			return nil, err
		}
	}
	return m, nil
}

// FullMeshLinked constructs a Mocknet with full mesh of Links.
// This means that all the peers **can** connect to each other
// (not that they already are connected. you can use m.ConnectAll())
func FullMeshLinked(ctx context.Context, n int) (Mocknet, error) {
	m, err := WithNPeers(ctx, n)
	if err != nil {
		return nil, err
	}

	if err := m.LinkAll(); err != nil {
开发者ID:djbarber,项目名称:ipfs-hack,代码行数:31,代码来源:mock.go

示例9: DefaultSplitter

// package chunk implements streaming block splitters
package chunk

import (
	"io"

	logging "github.com/djbarber/ipfs-hack/vendor/go-log-v1.0.0"
)

var log = logging.Logger("chunk")

var DefaultBlockSize int64 = 1024 * 256

type Splitter interface {
	NextBytes() ([]byte, error)
}

type SplitterGen func(r io.Reader) Splitter

func DefaultSplitter(r io.Reader) Splitter {
	return NewSizeSplitter(r, DefaultBlockSize)
}

func SizeSplitterGen(size int64) SplitterGen {
	return func(r io.Reader) Splitter {
		return NewSizeSplitter(r, size)
	}
}

func Chan(s Splitter) (<-chan []byte, <-chan error) {
	out := make(chan []byte)
开发者ID:djbarber,项目名称:ipfs-hack,代码行数:31,代码来源:splitting.go

示例10: main

	syncds "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/github.com/jbenet/go-datastore/sync"
	commands "github.com/djbarber/ipfs-hack/commands"
	core "github.com/djbarber/ipfs-hack/core"
	corehttp "github.com/djbarber/ipfs-hack/core/corehttp"
	corerouting "github.com/djbarber/ipfs-hack/core/corerouting"
	"github.com/djbarber/ipfs-hack/core/coreunix"
	peer "github.com/djbarber/ipfs-hack/p2p/peer"
	"github.com/djbarber/ipfs-hack/repo"
	config "github.com/djbarber/ipfs-hack/repo/config"
	fsrepo "github.com/djbarber/ipfs-hack/repo/fsrepo"
	unit "github.com/djbarber/ipfs-hack/thirdparty/unit"
	ds2 "github.com/djbarber/ipfs-hack/util/datastore2"
	logging "github.com/djbarber/ipfs-hack/vendor/go-log-v1.0.0"
)

var elog = logging.Logger("gc-client")

var (
	cat             = flag.Bool("cat", false, "else add")
	seed            = flag.Int64("seed", 1, "")
	nBitsForKeypair = flag.Int("b", 1024, "number of bits for keypair (if repo is uninitialized)")
)

func main() {
	flag.Parse()
	if err := run(); err != nil {
		fmt.Fprintf(os.Stderr, "error: %s\n", err)
		os.Exit(1)
	}
}
开发者ID:djbarber,项目名称:ipfs-hack,代码行数:30,代码来源:main.go

示例11: init

	swarm "github.com/djbarber/ipfs-hack/p2p/net/swarm"
	protocol "github.com/djbarber/ipfs-hack/p2p/protocol"
	testutil "github.com/djbarber/ipfs-hack/p2p/test/util"
	u "github.com/djbarber/ipfs-hack/util"
	logging "github.com/djbarber/ipfs-hack/vendor/go-log-v1.0.0"

	ps "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/github.com/jbenet/go-peerstream"
	context "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/golang.org/x/net/context"
)

func init() {
	// change the garbage collect timeout for testing.
	ps.GarbageCollectTimeout = 10 * time.Millisecond
}

var log = logging.Logger("reconnect")

func EchoStreamHandler(stream inet.Stream) {
	c := stream.Conn()
	log.Debugf("%s echoing %s", c.LocalPeer(), c.RemotePeer())
	go func() {
		defer stream.Close()
		io.Copy(stream, stream)
	}()
}

type sendChans struct {
	send   chan struct{}
	sent   chan struct{}
	read   chan struct{}
	close_ chan struct{}
开发者ID:djbarber,项目名称:ipfs-hack,代码行数:31,代码来源:reconnect_test.go

示例12:

// package kbucket implements a kademlia 'k-bucket' routing table.
package kbucket

import (
	"fmt"
	"sort"
	"sync"
	"time"

	peer "github.com/djbarber/ipfs-hack/p2p/peer"
	logging "github.com/djbarber/ipfs-hack/vendor/go-log-v1.0.0"
)

var log = logging.Logger("table")

// RoutingTable defines the routing table.
type RoutingTable struct {

	// ID of the local peer
	local ID

	// Blanket lock, refine later for better performance
	tabLock sync.RWMutex

	// latency metrics
	metrics peer.Metrics

	// Maximum acceptable latency for peers in this cluster
	maxLatency time.Duration

	// kBuckets define all the fingers to other nodes.
开发者ID:djbarber,项目名称:ipfs-hack,代码行数:31,代码来源:table.go

示例13: Test1KBInstantaneous

	"time"

	random "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/github.com/jbenet/go-random"
	context "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/golang.org/x/net/context"

	"github.com/djbarber/ipfs-hack/core"
	coreunix "github.com/djbarber/ipfs-hack/core/coreunix"
	mock "github.com/djbarber/ipfs-hack/core/mock"
	mocknet "github.com/djbarber/ipfs-hack/p2p/net/mock"
	"github.com/djbarber/ipfs-hack/p2p/peer"
	"github.com/djbarber/ipfs-hack/thirdparty/unit"
	testutil "github.com/djbarber/ipfs-hack/util/testutil"
	logging "github.com/djbarber/ipfs-hack/vendor/go-log-v1.0.0"
)

var log = logging.Logger("epictest")

const kSeed = 1

func Test1KBInstantaneous(t *testing.T) {
	conf := testutil.LatencyConfig{
		NetworkLatency:    0,
		RoutingLatency:    0,
		BlockstoreLatency: 0,
	}

	if err := DirectAddCat(RandomBytes(1*unit.KB), conf); err != nil {
		t.Fatal(err)
	}
}
开发者ID:djbarber,项目名称:ipfs-hack,代码行数:30,代码来源:addcat_test.go

示例14: NewChanQueue

package queue

import (
	context "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/golang.org/x/net/context"
	peer "github.com/djbarber/ipfs-hack/p2p/peer"
	logging "github.com/djbarber/ipfs-hack/vendor/go-log-v1.0.0"
)

var log = logging.Logger("peerqueue")

// ChanQueue makes any PeerQueue synchronizable through channels.
type ChanQueue struct {
	Queue   PeerQueue
	EnqChan chan<- peer.ID
	DeqChan <-chan peer.ID
}

// NewChanQueue creates a ChanQueue by wrapping pq.
func NewChanQueue(ctx context.Context, pq PeerQueue) *ChanQueue {
	cq := &ChanQueue{Queue: pq}
	cq.process(ctx)
	return cq
}

func (cq *ChanQueue) process(ctx context.Context) {
	// construct the channels here to be able to use them bidirectionally
	enqChan := make(chan peer.ID)
	deqChan := make(chan peer.ID)

	cq.EnqChan = enqChan
	cq.DeqChan = deqChan
开发者ID:djbarber,项目名称:ipfs-hack,代码行数:31,代码来源:sync.go

示例15: init

package addrutil

import (
	"fmt"

	logging "github.com/djbarber/ipfs-hack/vendor/go-log-v1.0.0"

	ma "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
	manet "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/github.com/jbenet/go-multiaddr-net"
	context "github.com/djbarber/ipfs-hack/Godeps/_workspace/src/golang.org/x/net/context"
)

var log = logging.Logger("p2p/net/swarm/addr")

// SupportedTransportStrings is the list of supported transports for the swarm.
// These are strings of encapsulated multiaddr protocols. E.g.:
//   /ip4/tcp
var SupportedTransportStrings = []string{
	"/ip4/tcp",
	"/ip6/tcp",
	// "/ip4/udp/utp", disabled because the lib is broken
	// "/ip6/udp/utp", disabled because the lib is broken
	// "/ip4/udp/udt", disabled because the lib doesnt work on arm
	// "/ip6/udp/udt", disabled because the lib doesnt work on arm
}

// SupportedTransportProtocols is the list of supported transports for the swarm.
// These are []ma.Protocol lists. Populated at runtime from SupportedTransportStrings
var SupportedTransportProtocols = [][]ma.Protocol{}

func init() {
开发者ID:djbarber,项目名称:ipfs-hack,代码行数:31,代码来源:addr.go


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