Compare commits
No commits in common. "master" and "v3" have entirely different histories.
@ -1,3 +1,3 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
//go:generate protoc -I./proto -I. --go_out=paths=source_relative:./proto --go-micro_out=components=micro|rpc,standalone=true,debug=true,paths=source_relative:./micro proto/service.proto
|
//go:generate protoc -I./proto -I. --go-grpc_out=paths=source_relative:./proto --go_out=paths=source_relative:./proto --go-micro_out=components=micro|rpc,standalone=true,debug=true,paths=source_relative:./micro proto/service.proto
|
||||||
|
19
go.mod
19
go.mod
@ -1,21 +1,10 @@
|
|||||||
module go.unistack.org/micro-logger-service/v4
|
module go.unistack.org/micro-logger-service/v3
|
||||||
|
|
||||||
go 1.20
|
go 1.16
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/google/uuid v1.3.0
|
github.com/google/uuid v1.3.0
|
||||||
go.unistack.org/micro-logger-service/v3 v3.8.1
|
go.unistack.org/micro/v3 v3.10.11
|
||||||
go.unistack.org/micro-server-http/v4 v4.0.1
|
google.golang.org/grpc v1.52.3
|
||||||
go.unistack.org/micro/v4 v4.0.1
|
|
||||||
google.golang.org/protobuf v1.28.1
|
google.golang.org/protobuf v1.28.1
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
|
||||||
github.com/golang/protobuf v1.5.2 // indirect
|
|
||||||
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
|
|
||||||
golang.org/x/net v0.7.0 // indirect
|
|
||||||
golang.org/x/sys v0.5.0 // indirect
|
|
||||||
golang.org/x/text v0.7.0 // indirect
|
|
||||||
google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 // indirect
|
|
||||||
google.golang.org/grpc v1.52.3 // indirect
|
|
||||||
)
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
|
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
|
||||||
// versions:
|
// protoc-gen-go-micro version: v3.5.3
|
||||||
// - protoc-gen-go-micro v4.0.0
|
|
||||||
// - protoc v3.21.12
|
|
||||||
// source: service.proto
|
// source: service.proto
|
||||||
|
|
||||||
package servicepb
|
package servicepb
|
||||||
@ -9,16 +7,19 @@ package servicepb
|
|||||||
import (
|
import (
|
||||||
context "context"
|
context "context"
|
||||||
proto "go.unistack.org/micro-logger-service/v3/proto"
|
proto "go.unistack.org/micro-logger-service/v3/proto"
|
||||||
v4 "go.unistack.org/micro-server-http/v4"
|
api "go.unistack.org/micro/v3/api"
|
||||||
client "go.unistack.org/micro/v4/client"
|
client "go.unistack.org/micro/v3/client"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
LoggerServiceName = "LoggerService"
|
LoggerServiceName = "LoggerService"
|
||||||
|
|
||||||
|
LoggerServiceEndpoints = []api.Endpoint{}
|
||||||
)
|
)
|
||||||
var (
|
|
||||||
LoggerServiceServerEndpoints = []v4.EndpointMetadata{}
|
func NewLoggerServiceEndpoints() []api.Endpoint {
|
||||||
)
|
return LoggerServiceEndpoints
|
||||||
|
}
|
||||||
|
|
||||||
type LoggerServiceClient interface {
|
type LoggerServiceClient interface {
|
||||||
Log(ctx context.Context, req *proto.LogReq, opts ...client.CallOption) (*proto.LogRsp, error)
|
Log(ctx context.Context, req *proto.LogReq, opts ...client.CallOption) (*proto.LogRsp, error)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
|
// Code generated by protoc-gen-go-micro. DO NOT EDIT.
|
||||||
// protoc-gen-go-micro version: v4.0.0
|
// protoc-gen-go-micro version: v3.5.3
|
||||||
// source: service.proto
|
// source: service.proto
|
||||||
|
|
||||||
package servicepb
|
package servicepb
|
||||||
@ -7,8 +7,9 @@ package servicepb
|
|||||||
import (
|
import (
|
||||||
context "context"
|
context "context"
|
||||||
proto "go.unistack.org/micro-logger-service/v3/proto"
|
proto "go.unistack.org/micro-logger-service/v3/proto"
|
||||||
client "go.unistack.org/micro/v4/client"
|
api "go.unistack.org/micro/v3/api"
|
||||||
server "go.unistack.org/micro/v4/server"
|
client "go.unistack.org/micro/v3/client"
|
||||||
|
server "go.unistack.org/micro/v3/server"
|
||||||
)
|
)
|
||||||
|
|
||||||
type loggerServiceClient struct {
|
type loggerServiceClient struct {
|
||||||
@ -46,5 +47,8 @@ func RegisterLoggerServiceServer(s server.Server, sh LoggerServiceServer, opts .
|
|||||||
}
|
}
|
||||||
h := &loggerServiceServer{sh}
|
h := &loggerServiceServer{sh}
|
||||||
var nopts []server.HandlerOption
|
var nopts []server.HandlerOption
|
||||||
|
for _, endpoint := range LoggerServiceEndpoints {
|
||||||
|
nopts = append(nopts, api.WithEndpoint(&endpoint))
|
||||||
|
}
|
||||||
return s.Handle(s.NewHandler(&LoggerService{h}, append(nopts, opts...)...))
|
return s.Handle(s.NewHandler(&LoggerService{h}, append(nopts, opts...)...))
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"go.unistack.org/micro/v4/client"
|
"go.unistack.org/micro/v3/client"
|
||||||
"go.unistack.org/micro/v4/logger"
|
"go.unistack.org/micro/v3/logger"
|
||||||
"go.unistack.org/micro/v4/store"
|
"go.unistack.org/micro/v3/store"
|
||||||
)
|
)
|
||||||
|
|
||||||
type clientKey struct{}
|
type clientKey struct{}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.26.0
|
// protoc-gen-go v1.26.0
|
||||||
// protoc v3.21.12
|
// protoc v3.19.4
|
||||||
// source: service.proto
|
// source: service.proto
|
||||||
|
|
||||||
package servicepb
|
package servicepb
|
||||||
|
105
proto/service_grpc.pb.go
Normal file
105
proto/service_grpc.pb.go
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// - protoc-gen-go-grpc v1.2.0
|
||||||
|
// - protoc v3.19.4
|
||||||
|
// source: service.proto
|
||||||
|
|
||||||
|
package servicepb
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
grpc "google.golang.org/grpc"
|
||||||
|
codes "google.golang.org/grpc/codes"
|
||||||
|
status "google.golang.org/grpc/status"
|
||||||
|
)
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the grpc package it is being compiled against.
|
||||||
|
// Requires gRPC-Go v1.32.0 or later.
|
||||||
|
const _ = grpc.SupportPackageIsVersion7
|
||||||
|
|
||||||
|
// LoggerServiceClient is the client API for LoggerService service.
|
||||||
|
//
|
||||||
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||||
|
type LoggerServiceClient interface {
|
||||||
|
Log(ctx context.Context, in *LogReq, opts ...grpc.CallOption) (*LogRsp, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type loggerServiceClient struct {
|
||||||
|
cc grpc.ClientConnInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewLoggerServiceClient(cc grpc.ClientConnInterface) LoggerServiceClient {
|
||||||
|
return &loggerServiceClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *loggerServiceClient) Log(ctx context.Context, in *LogReq, opts ...grpc.CallOption) (*LogRsp, error) {
|
||||||
|
out := new(LogRsp)
|
||||||
|
err := c.cc.Invoke(ctx, "/servicepb.LoggerService/Log", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoggerServiceServer is the server API for LoggerService service.
|
||||||
|
// All implementations must embed UnimplementedLoggerServiceServer
|
||||||
|
// for forward compatibility
|
||||||
|
type LoggerServiceServer interface {
|
||||||
|
Log(context.Context, *LogReq) (*LogRsp, error)
|
||||||
|
mustEmbedUnimplementedLoggerServiceServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnimplementedLoggerServiceServer must be embedded to have forward compatible implementations.
|
||||||
|
type UnimplementedLoggerServiceServer struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (UnimplementedLoggerServiceServer) Log(context.Context, *LogReq) (*LogRsp, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method Log not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedLoggerServiceServer) mustEmbedUnimplementedLoggerServiceServer() {}
|
||||||
|
|
||||||
|
// UnsafeLoggerServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||||
|
// Use of this interface is not recommended, as added methods to LoggerServiceServer will
|
||||||
|
// result in compilation errors.
|
||||||
|
type UnsafeLoggerServiceServer interface {
|
||||||
|
mustEmbedUnimplementedLoggerServiceServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterLoggerServiceServer(s grpc.ServiceRegistrar, srv LoggerServiceServer) {
|
||||||
|
s.RegisterService(&LoggerService_ServiceDesc, srv)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _LoggerService_Log_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(LogReq)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(LoggerServiceServer).Log(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/servicepb.LoggerService/Log",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(LoggerServiceServer).Log(ctx, req.(*LogReq))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoggerService_ServiceDesc is the grpc.ServiceDesc for LoggerService service.
|
||||||
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
|
// and not to be introspected or modified (even as a copy)
|
||||||
|
var LoggerService_ServiceDesc = grpc.ServiceDesc{
|
||||||
|
ServiceName: "servicepb.LoggerService",
|
||||||
|
HandlerType: (*LoggerServiceServer)(nil),
|
||||||
|
Methods: []grpc.MethodDesc{
|
||||||
|
{
|
||||||
|
MethodName: "Log",
|
||||||
|
Handler: _LoggerService_Log_Handler,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Streams: []grpc.StreamDesc{},
|
||||||
|
Metadata: "service.proto",
|
||||||
|
}
|
12
service.go
12
service.go
@ -1,4 +1,4 @@
|
|||||||
package service // import "go.unistack.org/micro-logger-service/v4"
|
package service // import "go.unistack.org/micro-logger-service/v3"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@ -6,11 +6,11 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
pbmicro "go.unistack.org/micro-logger-service/v4/micro"
|
pbmicro "go.unistack.org/micro-logger-service/v3/micro"
|
||||||
pb "go.unistack.org/micro-logger-service/v4/proto"
|
pb "go.unistack.org/micro-logger-service/v3/proto"
|
||||||
"go.unistack.org/micro/v4/client"
|
"go.unistack.org/micro/v3/client"
|
||||||
"go.unistack.org/micro/v4/logger"
|
"go.unistack.org/micro/v3/logger"
|
||||||
"go.unistack.org/micro/v4/store"
|
"go.unistack.org/micro/v3/store"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ logger.Logger = &serviceLogger{}
|
var _ logger.Logger = &serviceLogger{}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user