Change go-log links

This commit is contained in:
Asim Aslam 2019-05-31 00:38:05 +01:00
parent 5595a8e0e4
commit 4035ab5c7b
16 changed files with 91 additions and 16 deletions

View File

@ -7,7 +7,7 @@ import (
"github.com/bwmarrin/discordgo"
"github.com/micro/go-micro/agent/input"
"github.com/micro/go-log"
"github.com/micro/go-micro/util/log"
)
type discordConn struct {

View File

@ -7,7 +7,7 @@ import (
"github.com/forestgiant/sliceutil"
"github.com/micro/go-micro/agent/input"
"github.com/micro/go-log"
"github.com/micro/go-micro/util/log"
"gopkg.in/telegram-bot-api.v4"
)

View File

@ -20,9 +20,9 @@ import fmt "fmt"
import math "math"
import (
context "context"
client "github.com/micro/go-micro/client"
server "github.com/micro/go-micro/server"
context "context"
)
// Reference imports to suppress errors if they are not otherwise used.

View File

@ -7,8 +7,8 @@ import (
glog "github.com/go-log/log"
"github.com/google/uuid"
"github.com/micro/go-log"
"github.com/micro/go-micro/registry/memory"
"github.com/micro/go-micro/util/log"
)
func newTestRegistry() *memory.Registry {

View File

@ -10,9 +10,9 @@ import (
"time"
"github.com/micro/cli"
"github.com/micro/go-log"
"github.com/micro/go-micro/client"
"github.com/micro/go-micro/server"
"github.com/micro/go-micro/util/log"
// brokers
"github.com/micro/go-micro/broker"

75
codec/text/text.go Normal file
View File

@ -0,0 +1,75 @@
// Package text reads any text/* content-type
package text
import (
"fmt"
"io"
"io/ioutil"
"github.com/micro/go-micro/codec"
)
type Codec struct {
Conn io.ReadWriteCloser
}
// Frame gives us the ability to define raw data to send over the pipes
type Frame struct {
Data []byte
}
func (c *Codec) ReadHeader(m *codec.Message, t codec.MessageType) error {
return nil
}
func (c *Codec) ReadBody(b interface{}) error {
// read bytes
buf, err := ioutil.ReadAll(c.Conn)
if err != nil {
return err
}
switch b.(type) {
case *[]byte:
v := b.(*[]byte)
*v = buf
case *Frame:
v := b.(*Frame)
v.Data = buf
default:
return fmt.Errorf("failed to read body: %v is not type of *[]byte", b)
}
return nil
}
func (c *Codec) Write(m *codec.Message, b interface{}) error {
var v []byte
switch b.(type) {
case *Frame:
v = b.(*Frame).Data
case *[]byte:
ve := b.(*[]byte)
v = *ve
case []byte:
v = b.([]byte)
default:
return fmt.Errorf("failed to write: %v is not type of *[]byte or []byte", b)
}
_, err := c.Conn.Write(v)
return err
}
func (c *Codec) Close() error {
return c.Conn.Close()
}
func (c *Codec) String() string {
return "bytes"
}
func NewCodec(c io.ReadWriteCloser) codec.Codec {
return &Codec{
Conn: c,
}
}

2
go.mod
View File

@ -122,7 +122,7 @@ require (
github.com/mholt/certmagic v0.5.1 // indirect
github.com/michaelklishin/rabbit-hole v1.5.0 // indirect
github.com/micro/cli v0.2.0
github.com/micro/go-log v0.1.0
github.com/micro/go-micro/util/log v0.1.0
github.com/micro/go-rcache v0.3.0
github.com/micro/mdns v0.1.0
github.com/micro/util v0.2.0

4
go.sum
View File

@ -675,8 +675,8 @@ github.com/micro/cli v0.1.0 h1:5DT+QdbAPPQvB3gYTgwze7tFO1m+7DU1sz9XfQczbsc=
github.com/micro/cli v0.1.0/go.mod h1:jRT9gmfVKWSS6pkKcXQ8YhUyj6bzwxK8Fp5b0Y7qNnk=
github.com/micro/cli v0.2.0 h1:ut3rV5JWqZjsXIa2MvGF+qMUP8DAUTvHX9Br5gO4afA=
github.com/micro/cli v0.2.0/go.mod h1:jRT9gmfVKWSS6pkKcXQ8YhUyj6bzwxK8Fp5b0Y7qNnk=
github.com/micro/go-log v0.1.0 h1:szYSR+yyTsomZM2jyinJC5562DlqffSjHmTZFaeZ2vY=
github.com/micro/go-log v0.1.0/go.mod h1:qaFBF6d6Jk01Gz4cbMkCA2vVuLk3FSaLLjmEGrMCreA=
github.com/micro/go-micro/util/log v0.1.0 h1:szYSR+yyTsomZM2jyinJC5562DlqffSjHmTZFaeZ2vY=
github.com/micro/go-micro/util/log v0.1.0/go.mod h1:qaFBF6d6Jk01Gz4cbMkCA2vVuLk3FSaLLjmEGrMCreA=
github.com/micro/go-micro v0.23.0/go.mod h1:3z3lfMkNU9Sr1L/CxL++8pVJmQapRo0N6kNjwYDtOVs=
github.com/micro/go-micro v0.26.0/go.mod h1:CweCFO/pq8dCSIOdzVZ4ooIpUrKlyJ0AcFB269M7PgU=
github.com/micro/go-micro v0.26.1/go.mod h1:Jgc5gPEmDiG1TWE5Qnzzx5qyXnU9VTXKT1FkXkfvt8g=

View File

@ -7,8 +7,8 @@ import (
"sync"
"time"
log "github.com/micro/go-log"
"github.com/micro/go-micro/registry"
log "github.com/micro/go-micro/util/log"
)
// Cache is the registry cache interface

View File

@ -16,9 +16,9 @@ import (
"github.com/golang/protobuf/proto"
"github.com/google/uuid"
"github.com/hashicorp/memberlist"
log "github.com/micro/go-log"
"github.com/micro/go-micro/registry"
pb "github.com/micro/go-micro/registry/gossip/proto"
log "github.com/micro/go-micro/util/log"
"github.com/mitchellh/hashstructure"
)

View File

@ -9,8 +9,8 @@ import (
"path/filepath"
"github.com/fsouza/go-dockerclient"
"github.com/micro/go-log"
"github.com/micro/go-micro/runtime/package"
"github.com/micro/go-micro/util/log"
)
type Packager struct {

View File

@ -16,8 +16,8 @@ import (
"unicode"
"unicode/utf8"
"github.com/micro/go-log"
"github.com/micro/go-micro/codec"
"github.com/micro/go-micro/util/log"
)
var (

View File

@ -10,13 +10,13 @@ import (
"sync"
"time"
log "github.com/micro/go-log"
"github.com/micro/go-micro/broker"
"github.com/micro/go-micro/codec"
"github.com/micro/go-micro/metadata"
"github.com/micro/go-micro/registry"
"github.com/micro/go-micro/transport"
"github.com/micro/go-micro/util/addr"
log "github.com/micro/go-micro/util/log"
)
type rpcServer struct {

View File

@ -8,9 +8,9 @@ import (
"syscall"
"github.com/google/uuid"
log "github.com/micro/go-log"
"github.com/micro/go-micro/codec"
"github.com/micro/go-micro/registry"
log "github.com/micro/go-micro/util/log"
)
// Server is a simple micro server abstraction

View File

@ -7,10 +7,10 @@ import (
"testing"
glog "github.com/go-log/log"
"github.com/micro/go-log"
"github.com/micro/go-micro/client"
"github.com/micro/go-micro/registry/memory"
proto "github.com/micro/go-micro/server/debug/proto"
"github.com/micro/go-micro/util/log"
)
func testShutdown(wg *sync.WaitGroup, cancel func()) {

View File

@ -9,7 +9,7 @@ It defaults the logger to the stdlib log implementation.
Set the logger for micro libraries
```go
// import micro/go-log
// import go-micro/util/log
import "github.com/micro/go-micro/util/log"
// SetLogger expects github.com/go-log/log.Logger interface