Merge branch 'master' of github.com:dfuse-io/solana-go

This commit is contained in:
billettc 2020-11-17 07:15:12 -05:00
commit ff602fdde9
5 changed files with 15 additions and 20 deletions

View File

@ -15,13 +15,11 @@
package rpc
import (
"os"
"github.com/dfuse-io/logging"
"go.uber.org/zap"
)
var traceEnabled = os.Getenv("TRACE") == "true"
var traceEnabled = logging.IsTraceEnabled("solana-go", "github.com/dfuse-io/solana-go/rpc")
var zlog *zap.Logger
func init() {

View File

@ -89,11 +89,12 @@ func (c *Client) handleMessage(message []byte) {
func (c *Client) handleNewSubscriptionMessage(requestID, subID uint64) {
c.lock.Lock()
defer c.lock.Unlock()
zlog.Info("received new subscription message",
zap.Uint64("message_id", requestID),
zap.Uint64("subscription_id", subID),
)
if traceEnabled {
zlog.Debug("received new subscription message",
zap.Uint64("message_id", requestID),
zap.Uint64("subscription_id", subID),
)
}
callBack, found := c.subscriptionByRequestID[requestID]
if !found {
zlog.Error("cannot find websocket message handler for a new stream.... this should not happen",
@ -107,9 +108,11 @@ func (c *Client) handleNewSubscriptionMessage(requestID, subID uint64) {
}
func (c *Client) handleSubscriptionMessage(subID uint64, message []byte) {
zlog.Debug("received subscription message",
zap.Uint64("subscription_id", subID),
)
if traceEnabled {
zlog.Debug("received subscription message",
zap.Uint64("subscription_id", subID),
)
}
c.lock.RLock()
sub, found := c.subscriptionByWSSubID[subID]

View File

@ -15,14 +15,12 @@
package ws
import (
"os"
"github.com/dfuse-io/logging"
"go.uber.org/zap"
)
var traceEnabled = os.Getenv("TRACE") == "true"
var zlog *zap.Logger
var traceEnabled = logging.IsTraceEnabled("solana-go", "github.com/dfuse-io/solana-go/rpc/ws")
func init() {
logging.Register("github.com/dfuse-io/solana-go/rpc/ws", &zlog)

View File

@ -15,14 +15,12 @@
package serum
import (
"os"
"github.com/dfuse-io/logging"
"go.uber.org/zap"
)
var traceEnabled = os.Getenv("TRACE") != ""
var zlog = zap.NewNop()
var traceEnabled = logging.IsTraceEnabled("solana-go", "github.com/dfuse-io/solana-go/serum")
func init() {
logging.Register("github.com/dfuse-io/solana-go/serum", &zlog)

View File

@ -15,13 +15,11 @@
package system
import (
"os"
"github.com/dfuse-io/logging"
"go.uber.org/zap"
)
var traceEnabled = os.Getenv("TRACE") != ""
var traceEnabled = logging.IsTraceEnabled("solana-go", "github.com/dfuse-io/solana-go/system")
var zlog = zap.NewNop()
func init() {