Documentation ¶
Index ¶
- Constants
- Variables
- func InitDefaultLogger()
- func InitLogger(name string, cfg *logger.Config)
- func InitSimpleLogger(name, level string)
- type Callback
- type RecyclableChan
- func (c *RecyclableChan) Close() error
- func (c *RecyclableChan) Desc() string
- func (c *RecyclableChan) ExtData() any
- func (c *RecyclableChan) Flag1() int32
- func (c *RecyclableChan) Flag2() int32
- func (c *RecyclableChan) IsClosed() bool
- func (c *RecyclableChan) IsReadReady() bool
- func (c *RecyclableChan) Read(b []byte) (n int, err error)
- func (c *RecyclableChan) ReadPacket() (b []byte, err error)
- func (c *RecyclableChan) ReadStream(b []byte) (n int, err error)
- func (c *RecyclableChan) SetExtData(extData any)
- func (c *RecyclableChan) SetFlag1(flag1 int32)
- func (c *RecyclableChan) SetFlag2(flag2 int32)
- func (c *RecyclableChan) SetOnReadReady(callback func()) *RecyclableChan
- func (c *RecyclableChan) SetReadingAsPkt(asPkt bool) *RecyclableChan
- func (c *RecyclableChan) SetShouldDropWhileError(should bool) *RecyclableChan
- func (c *RecyclableChan) Write(data []byte) (n int, err error)
- type Result
- type State3
Constants ¶
View Source
const ( Black _TextColor = iota + 30 Red Green Yellow Blue Magenta Cyan White )
Foreground colors.
Variables ¶
View Source
var ( SUCCESS = &result{0, "", nil} UNKNOWN = &result{-1, "未知错误", nil} START = &result{-2000, "start of error", nil} END = &result{-3000, "end of error", nil} INVALID_PARAM = &result{START.ICode - 1, "无效的参数", nil} // invalid param TARGET_NOT_FOUND = &result{START.ICode - 2, "目标不存在", nil} // target not found ACTION_ILLEGAL = &result{START.ICode - 3, "操作非法", nil} // action illegal ACTION_TIMEOUT = &result{START.ICode - 4, "操作超时", nil} // action timeout ACTION_CANCELED = &result{START.ICode - 5, "操作被取消", nil} // action canceled ACTION_UNSUPPORTED = &result{START.ICode - 6, "不支持的操作", nil} // action unsupported LOGICAL_ERROR = &result{START.ICode - 7, "逻辑错误", nil} // logical error INTERNAL_ERROR = &result{START.ICode - 10, "内部错误", nil} // internal error REMOTE_SYSTEM_ERROR = &result{START.ICode - 11, "远端系统错误", nil} // remote system error TRY_AGAIN_LATER = &result{START.ICode - 12, "操作失败,稍后再试", nil} // action failed, try again later )
View Source
var (
ErrorChannelIsFull = errors.New("channel is full")
)
View Source
var ( RecommendedEncoderConfig = zapcore.EncoderConfig{ CallerKey: "caller", LevelKey: "level", MessageKey: "msg", TimeKey: "ts", StacktraceKey: "stacktrace", LineEnding: zapcore.DefaultLineEnding, EncodeTime: customTimeEncoder, EncodeLevel: customLevelEncoder, EncodeCaller: customCallerEncoder, EncodeDuration: zapcore.SecondsDurationEncoder, EncodeName: zapcore.FullNameEncoder, ConsoleSeparator: " ", } )
Functions ¶
func InitDefaultLogger ¶
func InitDefaultLogger()
func InitLogger ¶
func InitSimpleLogger ¶
func InitSimpleLogger(name, level string)
Types ¶
type RecyclableChan ¶
type RecyclableChan struct {
// contains filtered or unexported fields
}
func NewRecyclableChan ¶
func NewRecyclableChan(desc string, maxPktCnt uint32, extData any) *RecyclableChan
func (*RecyclableChan) Close ¶
func (c *RecyclableChan) Close() error
func (*RecyclableChan) Desc ¶
func (c *RecyclableChan) Desc() string
func (*RecyclableChan) ExtData ¶
func (c *RecyclableChan) ExtData() any
func (*RecyclableChan) Flag1 ¶
func (c *RecyclableChan) Flag1() int32
func (*RecyclableChan) Flag2 ¶
func (c *RecyclableChan) Flag2() int32
func (*RecyclableChan) IsClosed ¶
func (c *RecyclableChan) IsClosed() bool
func (*RecyclableChan) IsReadReady ¶
func (c *RecyclableChan) IsReadReady() bool
func (*RecyclableChan) ReadPacket ¶
func (c *RecyclableChan) ReadPacket() (b []byte, err error)
func (*RecyclableChan) ReadStream ¶
func (c *RecyclableChan) ReadStream(b []byte) (n int, err error)
func (*RecyclableChan) SetExtData ¶
func (c *RecyclableChan) SetExtData(extData any)
func (*RecyclableChan) SetFlag1 ¶
func (c *RecyclableChan) SetFlag1(flag1 int32)
func (*RecyclableChan) SetFlag2 ¶
func (c *RecyclableChan) SetFlag2(flag2 int32)
func (*RecyclableChan) SetOnReadReady ¶
func (c *RecyclableChan) SetOnReadReady(callback func()) *RecyclableChan
func (*RecyclableChan) SetReadingAsPkt ¶
func (c *RecyclableChan) SetReadingAsPkt(asPkt bool) *RecyclableChan
func (*RecyclableChan) SetShouldDropWhileError ¶
func (c *RecyclableChan) SetShouldDropWhileError(should bool) *RecyclableChan
Source Files ¶
Click to show internal directories.
Click to hide internal directories.