Skip to content

Commit

Permalink
feat(devtools): retrieve recent logs from the API
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed Nov 9, 2018
1 parent e4c3222 commit 2ae5f39
Show file tree
Hide file tree
Showing 26 changed files with 1,195 additions and 156 deletions.
12 changes: 12 additions & 0 deletions client/react-native/common/schema.graphql

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions client/react-native/gomobile/Makefile
Expand Up @@ -30,6 +30,7 @@ ANDROID_BUILD := $(addprefix $(ANDROID_BUILD_PATH)/core., $(addsuffix .aar, $(AN

GOTEST_TIMEOUT ?= 30s


.PHONY: help
help:
@echo "Gomobile commands:"
Expand Down
1 change: 1 addition & 0 deletions client/react-native/gomobile/core/core.go
Expand Up @@ -183,6 +183,7 @@ func daemon(nickname, datastorePath string, loggerNative Logger) error {
}

accountOptions := account.Options{
account.WithRing(ring),
account.WithName(nickname),
account.WithPassphrase("secure"),
account.WithDatabase(&account.DatabaseOptions{
Expand Down
10 changes: 7 additions & 3 deletions client/react-native/gomobile/core/logger.go
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"

"berty.tech/core/pkg/filteredzap"
"berty.tech/core/pkg/zapring"
p2plog "github.com/ipfs/go-log"
"github.com/whyrusleeping/go-logging"
"go.uber.org/zap"
Expand Down Expand Up @@ -80,6 +81,8 @@ func getP2PLogLevel(level zapcore.Level) logging.Level {
return logging.CRITICAL
}

var ring = zapring.New(10 * 1024 * 1024)

func setupLogger(logLevel string, mlogger Logger) error {
var zapLogLevel zapcore.Level
switch logLevel {
Expand Down Expand Up @@ -114,9 +117,10 @@ func setupLogger(logLevel string, mlogger Logger) error {

core := zap.WrapCore(func(core zapcore.Core) zapcore.Core {
consoleEncoder := zapcore.NewConsoleEncoder(config.EncoderConfig)
mobileCore := newMobileCore(core, consoleEncoder, mlogger)
filteredCore := filteredzap.FilterByNamespace(mobileCore, "*")
return filteredCore
core = newMobileCore(core, consoleEncoder, mlogger) // mobile logger
core = filteredzap.FilterByNamespace(core, "*") // filtered logger
core = ring.Wrap(core, consoleEncoder) // in-memory ring buffer
return core
})

zap.ReplaceGlobals(l.WithOptions(core))
Expand Down
2 changes: 1 addition & 1 deletion client/react-native/gomobile/go.mod
Expand Up @@ -8,7 +8,7 @@ require (
github.com/pkg/errors v0.8.0
github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc
go.uber.org/zap v1.9.1
golang.org/x/mobile v0.0.0-20181010163405-92f3b9caf7ba // indirect
golang.org/x/mobile v0.0.0-20181026062114-a27dd33d354d // indirect
)

replace berty.tech/core v0.0.0 => ../../../core
4 changes: 4 additions & 0 deletions client/react-native/gomobile/go.sum
Expand Up @@ -225,6 +225,8 @@ github.com/libp2p/go-testutil v1.2.8/go.mod h1:8FHCRBHdt9BibhKebrOqVTJyW4cOZc52b
github.com/libp2p/go-ws-transport v2.0.14+incompatible h1:wnf+ND4tot8DdqdpveeieToUtIMCmA2TWcdrdZ/Xwmo=
github.com/libp2p/go-ws-transport v2.0.14+incompatible/go.mod h1:qx7Dcw4onTaVNI3iG6q3XOKwNQWnXYhNEHYmhgQmKKk=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/maruel/circular v0.0.0-20161028021427-97eeabbe7b43 h1:Fefy2DSaKkme73mCUM2YJxNmi4dC1vrGzs+sjcoxXE4=
github.com/maruel/circular v0.0.0-20161028021427-97eeabbe7b43/go.mod h1:2R57jb7EgkTrwIT4IRrrJ2I4m10M83Zf7e6ej1Cer9c=
github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=
Expand Down Expand Up @@ -339,6 +341,8 @@ golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTk
golang.org/x/lint v0.0.0-20181011164241-5906bd5c48cd/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/mobile v0.0.0-20181010163405-92f3b9caf7ba h1:WoaHlcpvJeZkxHa+yq/jl4NazzTM0lWKCRpRGjotZto=
golang.org/x/mobile v0.0.0-20181010163405-92f3b9caf7ba/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
golang.org/x/mobile v0.0.0-20181026062114-a27dd33d354d h1:DuZZDdMFwDrzmycNhCaWSve7Vh+BIrjm7ttgb4fD3Os=
golang.org/x/mobile v0.0.0-20181026062114-a27dd33d354d/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
golang.org/x/net v0.0.0-20180524181706-dfa909b99c79/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down
18 changes: 18 additions & 0 deletions core/api/client/berty.node.service.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions core/api/client/jsonclient/berty.node.service.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions core/api/node/graphql/gqlgen.gen.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2ae5f39

Please sign in to comment.