Skip to content

Commit

Permalink
rename xoplog -> xop
Browse files Browse the repository at this point in the history
  • Loading branch information
muir committed Jul 27, 2022
1 parent 29f2488 commit 88d5182
Show file tree
Hide file tree
Showing 30 changed files with 94 additions and 128 deletions.
6 changes: 3 additions & 3 deletions base.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package xoplog
package xop

import (
"github.com/muir/xoplog/xopbase"
"github.com/muir/xoplog/xopconst"
"github.com/muir/xop/xopbase"
"github.com/muir/xop/xopconst"
)

type loggers struct {
Expand Down
8 changes: 4 additions & 4 deletions basegroup.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// This file is generated, DO NOT EDIT. It comes from the corresponding .zzzgo file

package xoplog
package xop

import (
"sync"
"time"

"github.com/muir/xoplog/trace"
"github.com/muir/xoplog/xopbase"
"github.com/muir/xoplog/xopconst"
"github.com/muir/xop/trace"
"github.com/muir/xop/xopbase"
"github.com/muir/xop/xopconst"
)

type (
Expand Down
8 changes: 4 additions & 4 deletions basegroup.zzzgo
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package xoplog
package xop

import (
"sync"
"time"

"github.com/muir/xoplog/trace"
"github.com/muir/xoplog/xopbase"
"github.com/muir/xoplog/xopconst"
"github.com/muir/xop/trace"
"github.com/muir/xop/xopbase"
"github.com/muir/xop/xopconst"
)

type baseLoggers []xopbase.Logger
Expand Down
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xoplog
package xop

import (
golog "log"
Expand Down
2 changes: 1 addition & 1 deletion context.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xoplog
package xop

import (
"context"
Expand Down
7 changes: 3 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
module github.com/muir/xoplog
module github.com/muir/xop

go 1.16

replace github.com/muir/rest v0.0.0 => ../rest

require (
github.com/dmarkham/enumer v1.5.5
github.com/google/uuid v1.3.0 // indirect
github.com/google/uuid v1.3.0
github.com/gorilla/mux v1.8.0
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
github.com/muir/rest v0.0.0
github.com/phuslu/fasttime v1.0.0 // indirect
github.com/phuslu/fasttime v1.0.0
github.com/stretchr/testify v1.8.0
)
33 changes: 0 additions & 33 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dmarkham/enumer v1.5.5 h1:LpOGL3PQTPOM87rgowZEf7Z5EmkgnKqUtS92Vo+vqzs=
github.com/dmarkham/enumer v1.5.5/go.mod h1:qHwULwuCxYFAFM5KCkpF1U/U0BF5sNQKLccvUzKNY2w=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
github.com/pascaldekloe/name v1.0.0 h1:n7LKFgHixETzxpRv2R77YgPUFo85QHGZKrdaYm7eY5U=
github.com/pascaldekloe/name v1.0.0/go.mod h1:Z//MfYJnH4jVpQ9wkclwu2I2MkHmXTlT9wR5UZScttM=
github.com/phuslu/fasttime v1.0.0 h1:SUkNta9tJLy54glGb/Z4+/NJ7aXiLogVuSPEXAya6i8=
github.com/phuslu/fasttime v1.0.0/go.mod h1:1zflhZFowg3RSL0IpmWQ0AprKCKbTRKV9PEpVXDBZ7A=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
Expand All @@ -22,35 +18,6 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 h1:kQgndtyPBW/JIYERgdxfwMYh3AVStj88WQTlNDi2a+o=
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0=
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.10 h1:QjFRCZxdOhBJ/UNgnBZLbNV13DlbnK0quyivTnXJM20=
golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down
8 changes: 4 additions & 4 deletions logger.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xoplog
package xop

import (
"fmt"
Expand All @@ -8,9 +8,9 @@ import (
"sync/atomic"
"time"

"github.com/muir/xoplog/trace"
"github.com/muir/xoplog/xopbase"
"github.com/muir/xoplog/xopconst"
"github.com/muir/xop/trace"
"github.com/muir/xop/xopbase"
"github.com/muir/xop/xopconst"

"github.com/mohae/deepcopy"
)
Expand Down
18 changes: 9 additions & 9 deletions rest/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"net/http"

"github.com/gorilla/mux"
"github.com/muir/xoplog"
"github.com/muir/xoplog/trace"
"github.com/muir/xoplog/xopconst"
"github.com/muir/xoplog/xopprop"
"github.com/muir/xop"
"github.com/muir/xop/trace"
"github.com/muir/xop/xopconst"
"github.com/muir/xop/xopprop"
)

func makeChildSpan(parent xoplog.Log, r *http.Request) *xoplog.Log {
func makeChildSpan(parent xop.Log, r *http.Request) *xop.Log {
route := mux.CurrentRoute(r)
name := route.GetName()
if name == "" {
Expand Down Expand Up @@ -45,14 +45,14 @@ func makeChildSpan(parent xoplog.Log, r *http.Request) *xoplog.Log {
bundle.Trace.SpanID().SetRandom()
}

log := parent.Span().Seed(xoplog.WithBundle(bundle)).Request(r.Method + " " + name)
log := parent.Span().Seed(xop.WithBundle(bundle)).Request(r.Method + " " + name)
log.Span().Enum(xopconst.SpanKind, xopconst.SpanKindClient)
log.Span().EmbeddedEnum(xopconst.SpanTypeHTTPClientRequest)
log.Span().Str(xopconst.URL, r.URL.String())
return log
}

func ParentLogMiddleware(parentLog xoplog.Log) func(http.HandlerFunc) http.HandlerFunc {
func ParentLogMiddleware(parentLog xop.Log) func(http.HandlerFunc) http.HandlerFunc {
return func(next http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
Expand All @@ -65,8 +65,8 @@ func ParentLogMiddleware(parentLog xoplog.Log) func(http.HandlerFunc) http.Handl
}

// MakeLogInjector is compatible with https://github.com/muir/nject/nvelope
func MakeLogInjector(parentLog xoplog.Log) func(func(*xoplog.Log), *http.Request) {
return func(inner func(*xoplog.Log), r *http.Request) {
func MakeLogInjector(parentLog xop.Log) func(func(*xop.Log), *http.Request) {
return func(inner func(*xop.Log), r *http.Request) {
log := makeChildSpan(parentLog, r)
defer log.Done()
inner(log)
Expand Down
12 changes: 6 additions & 6 deletions rest/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"net/http"

"github.com/muir/rest"
"github.com/muir/xoplog"
"github.com/muir/xoplog/trace"
"github.com/muir/xoplog/xopconst"
"github.com/muir/xop"
"github.com/muir/xop/trace"
"github.com/muir/xop/xopconst"
)

var (
Expand All @@ -18,8 +18,8 @@ var (
xopconst.URL.Key())
)

func Log(log xoplog.Log) *rest.RequestOpts {
var step *xoplog.Log
func Log(log xop.Log) *rest.RequestOpts {
var step *xop.Log
var farSideSpan trace.HexBytes8
return rest.Make().
DoBefore(func(o *rest.RequestOpts, r *http.Request) error {
Expand All @@ -46,7 +46,7 @@ func Log(log xoplog.Log) *rest.RequestOpts {
return nil
}).
DoAfter(func(result rest.Result) rest.Result {
var line *xoplog.LogLine
var line *xop.LogLine
if result.Error != nil {
line = step.Error()
} else {
Expand Down
8 changes: 4 additions & 4 deletions seed.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// This file is generated, DO NOT EDIT. It comes from the corresponding .zzzgo file

package xoplog
package xop

import (
"time"

"github.com/muir/xoplog/trace"
"github.com/muir/xoplog/xopbase"
"github.com/muir/xoplog/xopconst"
"github.com/muir/xop/trace"
"github.com/muir/xop/xopbase"
"github.com/muir/xop/xopconst"
)

// Seed is used to create a Log.
Expand Down
8 changes: 4 additions & 4 deletions seed.zzzgo
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package xoplog
package xop

import (
"time"

"github.com/muir/xoplog/trace"
"github.com/muir/xoplog/xopbase"
"github.com/muir/xoplog/xopconst"
"github.com/muir/xop/trace"
"github.com/muir/xop/xopbase"
"github.com/muir/xop/xopconst"
)

// Seed is used to create a Log.
Expand Down
6 changes: 3 additions & 3 deletions span.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// This file is generated, DO NOT EDIT. It comes from the corresponding .zzzgo file

package xoplog
package xop

import (
"time"

"github.com/muir/xoplog/trace"
"github.com/muir/xoplog/xopconst"
"github.com/muir/xop/trace"
"github.com/muir/xop/xopconst"

"github.com/mohae/deepcopy"
)
Expand Down
6 changes: 3 additions & 3 deletions span.zzzgo
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package xoplog
package xop

import (
"github.com/muir/xoplog/trace"
"github.com/muir/xoplog/xopconst"
"github.com/muir/xop/trace"
"github.com/muir/xop/xopconst"

"github.com/mohae/deepcopy"
)
Expand Down
2 changes: 1 addition & 1 deletion support.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xoplog
package xop

import (
"strconv"
Expand Down
2 changes: 1 addition & 1 deletion support_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package xoplog
package xop

import (
"testing"
Expand Down
6 changes: 3 additions & 3 deletions xopbase/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ package xopbase
import (
"time"

"github.com/muir/xoplog/trace"
"github.com/muir/xoplog/xopconst"
"github.com/muir/xop/trace"
"github.com/muir/xop/xopconst"
)

// Logger is the bottom half of a logger -- the part that actually
Expand All @@ -28,7 +28,7 @@ type Logger interface {

// ReferencesKept should return true if Any() objects are not immediately
// serialized (the object is kept around and serilized later). If copies
// are kept, then xoplog.Log will make copies.
// are kept, then xop.Log will make copies.
ReferencesKept() bool

// Buffered should return true if the logger buffers output and sends
Expand Down
6 changes: 3 additions & 3 deletions xopbase/base.zzzgo
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package xopbase
import (
"time"

"github.com/muir/xoplog/trace"
"github.com/muir/xoplog/xopconst"
"github.com/muir/xop/trace"
"github.com/muir/xop/xopconst"
)

// Logger is the bottom half of a logger -- the part that actually
Expand All @@ -26,7 +26,7 @@ type Logger interface {

// ReferencesKept should return true if Any() objects are not immediately
// serialized (the object is kept around and serilized later). If copies
// are kept, then xoplog.Log will make copies.
// are kept, then xop.Log will make copies.
ReferencesKept() bool

// Buffered should return true if the logger buffers output and sends
Expand Down
10 changes: 5 additions & 5 deletions xopbase/xopjson/jsonlogger.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (
"sync/atomic"
"time"

"github.com/muir/xoplog/trace"
"github.com/muir/xoplog/xopbase"
"github.com/muir/xoplog/xopbytes"
"github.com/muir/xoplog/xopconst"
"github.com/muir/xoplog/xoputil"
"github.com/muir/xop/trace"
"github.com/muir/xop/xopbase"
"github.com/muir/xop/xopbytes"
"github.com/muir/xop/xopconst"
"github.com/muir/xop/xoputil"

"github.com/google/uuid"
"github.com/phuslu/fasttime"
Expand Down
8 changes: 4 additions & 4 deletions xopbase/xopjson/jsonlogger.zzzgo
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"sync/atomic"
"time"

"github.com/muir/xoplog/trace"
"github.com/muir/xoplog/xopbase"
"github.com/muir/xoplog/xopconst"
"github.com/muir/xoplog/xoputil"
"github.com/muir/xop/trace"
"github.com/muir/xop/xopbase"
"github.com/muir/xop/xopconst"
"github.com/muir/xop/xoputil"

"github.com/google/uuid"
"github.com/phuslu/fasttime"
Expand Down
Loading

0 comments on commit 88d5182

Please sign in to comment.