Skip to content

Commit

Permalink
♻️ Migrate standard Go logger -> emo
Browse files Browse the repository at this point in the history
  • Loading branch information
0uep committed Aug 31, 2022
1 parent f3ce861 commit 1f73db8
Show file tree
Hide file tree
Showing 17 changed files with 34 additions and 19 deletions.
1 change: 0 additions & 1 deletion cmd/cli/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package main

import (
"flag"
"log"

"github.com/teal-finance/garcon"
"github.com/teal-finance/rainbow/pkg/provider"
Expand Down
4 changes: 3 additions & 1 deletion cmd/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@ package main

import (
"fmt"
"log"
"math"
"os"

"github.com/gookit/color"
"github.com/jedib0t/go-pretty/v6/table"

"github.com/teal-finance/emo"
"github.com/teal-finance/rainbow/pkg/provider"
"github.com/teal-finance/rainbow/pkg/rainbow"
"github.com/teal-finance/rainbow/pkg/rainbow/api"
"github.com/teal-finance/rainbow/pkg/rainbow/storage/dbram"
)

var log = emo.NewZone("cli")

func main() {
parseFlags()

Expand Down
4 changes: 2 additions & 2 deletions cmd/client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import (
"github.com/teal-finance/garcon"
)

var log = emo.NewZone("client")
var log = emo.NewZone("client", true, true, true, true)

func main() {
garcon.LogVersion()
log.Print = true
log.PrintAll = true

parseFlags()

Expand Down
1 change: 0 additions & 1 deletion cmd/server/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package main

import (
"flag"
"log"
"strconv"
"time"

Expand Down
6 changes: 4 additions & 2 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@
package main

import (
"log"
"net/http"
"time"

"github.com/go-chi/chi/v5"

"github.com/teal-finance/emo"
"github.com/teal-finance/garcon"
"github.com/teal-finance/rainbow/pkg/provider"
"github.com/teal-finance/rainbow/pkg/rainbow"
"github.com/teal-finance/rainbow/pkg/rainbow/api"
"github.com/teal-finance/rainbow/pkg/rainbow/storage/dbram"
)

var log = emo.NewZone("rainbow")

func main() {
parseFlags()

Expand Down Expand Up @@ -114,6 +116,6 @@ func main() {
ErrorLog: log.Default(),
}

log.Print("INF Server listening on http://localhost", server.Addr)
log.Print("INF Server listening on http://localhost" + server.Addr)
log.Fatal(server.ListenAndServe())
}
1 change: 0 additions & 1 deletion pkg/provider/alerter.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package provider

import (
"fmt"
"log"
"strconv"
"time"

Expand Down
4 changes: 3 additions & 1 deletion pkg/provider/deltaexchange/delta.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ package deltaexchange

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

"github.com/teal-finance/emo"
"github.com/teal-finance/garcon"
"github.com/teal-finance/rainbow/pkg/rainbow"
)

var log = emo.NewZone("Delta")

const (
deltaProducts = "https://api.delta.exchange/v2/products?states=live&contract_types=put_options,call_options"
deltaOrders = "https://api.delta.exchange/v2/l2orderbook/"
Expand Down
4 changes: 3 additions & 1 deletion pkg/provider/deribit/deribit.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@
package deribit

import (
"log"
"sort"
"strconv"
"strings"
"time"

"github.com/teal-finance/emo"
"github.com/teal-finance/garcon"
"github.com/teal-finance/rainbow/pkg/rainbow"
)

var log = emo.NewZone("Deribit")

type Provider struct {
ar garcon.AdaptiveRate
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/provider/lyra/lyra.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@
package lyra

import (
"log"
"math/big"
"time"

"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"

"github.com/teal-finance/emo"
"github.com/teal-finance/rainbow/pkg/rainbow"
)

var log = emo.NewZone("Lyra")

const (
optimismrpc = "https://opt-mainnet.g.alchemy.com/v2/6_IOOvszkG_h71cZH3ybdKrgPPwAUx6m" // "https://mainnet.optimism.io"
name = "Lyra"
Expand Down
4 changes: 3 additions & 1 deletion pkg/provider/providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
package provider

import (
"log"
"os"

"github.com/teal-finance/emo"
"github.com/teal-finance/garcon"
"github.com/teal-finance/notifier"
"github.com/teal-finance/notifier/logger"
Expand All @@ -23,6 +23,8 @@ import (
"github.com/teal-finance/rainbow/pkg/rainbow"
)

var log = emo.NewZone("Provider")

// AllProviders returns all supported providers.
func AllProviders() []rainbow.Provider {
return []rainbow.Provider{
Expand Down
4 changes: 3 additions & 1 deletion pkg/provider/thales/thales.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"bytes"
"context"
"fmt"
"log"
"math/big"
"time"

Expand All @@ -19,11 +18,14 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"

"github.com/teal-finance/emo"
"github.com/teal-finance/rainbow/pkg/provider/the-graph/thales"
"github.com/teal-finance/rainbow/pkg/provider/zerox"
"github.com/teal-finance/rainbow/pkg/rainbow"
)

var log = emo.NewZone("Thales")

const (
// thegraph urls.
urlOptimism = "https://api.thegraph.com/subgraphs/name/thales-markets/thales-optimism"
Expand Down
4 changes: 3 additions & 1 deletion pkg/provider/zerox/0x.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@ package zerox

import (
"fmt"
"log"
"math"
"net/http"
"strconv"
"time"

"github.com/teal-finance/emo"
"github.com/teal-finance/garcon"
"github.com/teal-finance/rainbow/pkg/provider/the-graph/opyn"
"github.com/teal-finance/rainbow/pkg/rainbow"
)

var log = emo.NewZone("0x")

const (
USDC = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
Expand Down
1 change: 0 additions & 1 deletion pkg/provider/zerox/opyn.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package zerox

import (
"context"
"log"
"strconv"
"time"

Expand Down
1 change: 0 additions & 1 deletion pkg/rainbow/api/call-put.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package api

import (
"encoding/json"
"log"
"math"
"net/http"
"time"
Expand Down
4 changes: 3 additions & 1 deletion pkg/rainbow/api/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ import (
"encoding/csv"
"encoding/json"
"fmt"
"log"
"net/http"
"strings"

"github.com/mpvl/unique"

"github.com/teal-finance/emo"
"github.com/teal-finance/garcon"
"github.com/teal-finance/rainbow/pkg/rainbow"
)

var log = emo.NewZone("API")

type Handler struct {
Service *rainbow.Service
align Align
Expand Down
1 change: 0 additions & 1 deletion pkg/rainbow/common.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package rainbow

import (
"log"
"math"
"math/big"
"strconv"
Expand Down
5 changes: 4 additions & 1 deletion pkg/rainbow/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
package rainbow

import (
"log"
"time"

"github.com/teal-finance/emo"
)

var log = emo.NewZone("Service")

type Provider interface {
Name() string
Options() ([]Option, error)
Expand Down

0 comments on commit 1f73db8

Please sign in to comment.