Documentation ¶
Index ¶
- func AESDecode(data string, key string) (string, error)
- func AESDecodeByte(data []byte, key []byte) ([]byte, error)
- func AESEncode(data string, key string) (string, error)
- func AESEncodeByte(data []byte, key []byte) ([]byte, error)
- func Base64Decode(data string) (string, error)
- func Base64DecodeByte(data []byte) ([]byte, error)
- func Base64Encode(data string) string
- func Base64EncodeByte(data []byte) []byte
- func EncodeMd5(value string) string
- func EncodeSha1(value string) string
- func GetRandomString(n int, alphabets ...byte) string
- func NewError(msg string, v ...interface{}) error
- func NewErrorWithCode(code int, msg string, v ...interface{}) error
- func NewInternelError() error
- func NewInvalidJsonError() error
- func NewLoginRequiredError() error
- func NewNoAccessPermissionError(msg string) error
- func NewNotFoundError() error
- func NewParamRequiredError(name string) error
- type Error
- type ILogger
- type LogLevel
- type SimpleLogger
- func (s *SimpleLogger) Debug(v ...interface{}) (err error)
- func (s *SimpleLogger) Debugf(format string, v ...interface{}) (err error)
- func (s *SimpleLogger) Err(v ...interface{}) (err error)
- func (s *SimpleLogger) Errf(format string, v ...interface{}) (err error)
- func (s *SimpleLogger) Info(v ...interface{}) (err error)
- func (s *SimpleLogger) Infof(format string, v ...interface{}) (err error)
- func (s *SimpleLogger) Level() LogLevel
- func (s *SimpleLogger) SetLevel(l LogLevel) (err error)
- func (s *SimpleLogger) Warning(v ...interface{}) (err error)
- func (s *SimpleLogger) Warningf(format string, v ...interface{}) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Base64Decode ¶
func Base64DecodeByte ¶
func Base64Encode ¶
func Base64EncodeByte ¶
func EncodeSha1 ¶
func GetRandomString ¶
func NewErrorWithCode ¶
func NewInternelError ¶
func NewInternelError() error
func NewInvalidJsonError ¶
func NewInvalidJsonError() error
func NewLoginRequiredError ¶
func NewLoginRequiredError() error
func NewNotFoundError ¶
func NewNotFoundError() error
func NewParamRequiredError ¶
Types ¶
type Error ¶
type Error struct { Code int `json:"code"` Message string `json:"message"` Data interface{} `json:"data,omitempty"` }
func (*Error) MarshalJSON ¶
type ILogger ¶
type ILogger interface { Debug(v ...interface{}) (err error) Debugf(format string, v ...interface{}) (err error) Err(v ...interface{}) (err error) Errf(format string, v ...interface{}) (err error) Info(v ...interface{}) (err error) Infof(format string, v ...interface{}) (err error) Warning(v ...interface{}) (err error) Warningf(format string, v ...interface{}) (err error) Level() LogLevel SetLevel(l LogLevel) (err error) }
logger interface
type LogLevel ¶
type LogLevel int
const ( // !nashtsai! following level also match syslog.Priority value LOG_UNKNOWN LogLevel = iota - 2 LOG_OFF LogLevel = iota - 1 LOG_ERR LogLevel = iota + 3 LOG_WARNING LOG_INFO LogLevel = iota + 6 LOG_DEBUG DEFAULT_LOG_PREFIX = "[codexx]" DEFAULT_LOG_FLAG = log.Ldate | log.Lmicroseconds DEFAULT_LOG_LEVEL = LOG_DEBUG )
type SimpleLogger ¶
type SimpleLogger struct { DEBUG *log.Logger ERR *log.Logger INFO *log.Logger WARN *log.Logger // contains filtered or unexported fields }
func NewSimpleLogger ¶
func NewSimpleLogger(out io.Writer) *SimpleLogger
func NewSimpleLogger2 ¶
func NewSimpleLogger2(out io.Writer, prefix string, flag int) *SimpleLogger
func NewSimpleLogger3 ¶
func (*SimpleLogger) Debug ¶
func (s *SimpleLogger) Debug(v ...interface{}) (err error)
func (*SimpleLogger) Debugf ¶
func (s *SimpleLogger) Debugf(format string, v ...interface{}) (err error)
func (*SimpleLogger) Err ¶
func (s *SimpleLogger) Err(v ...interface{}) (err error)
func (*SimpleLogger) Errf ¶
func (s *SimpleLogger) Errf(format string, v ...interface{}) (err error)
func (*SimpleLogger) Info ¶
func (s *SimpleLogger) Info(v ...interface{}) (err error)
func (*SimpleLogger) Infof ¶
func (s *SimpleLogger) Infof(format string, v ...interface{}) (err error)
func (*SimpleLogger) Level ¶
func (s *SimpleLogger) Level() LogLevel
func (*SimpleLogger) SetLevel ¶
func (s *SimpleLogger) SetLevel(l LogLevel) (err error)
func (*SimpleLogger) Warning ¶
func (s *SimpleLogger) Warning(v ...interface{}) (err error)
func (*SimpleLogger) Warningf ¶
func (s *SimpleLogger) Warningf(format string, v ...interface{}) (err error)
Click to show internal directories.
Click to hide internal directories.