forked from forgejo/forgejo
golint fixed for modules/log
This commit is contained in:
parent
0a76d260fa
commit
3228544c31
5 changed files with 86 additions and 56 deletions
|
@ -23,20 +23,20 @@ type ConnWriter struct {
|
|||
Level int `json:"level"`
|
||||
}
|
||||
|
||||
// create new ConnWrite returning as LoggerInterface.
|
||||
// NewConn creates new ConnWrite returning as LoggerInterface.
|
||||
func NewConn() LoggerInterface {
|
||||
conn := new(ConnWriter)
|
||||
conn.Level = TRACE
|
||||
return conn
|
||||
}
|
||||
|
||||
// init connection writer with json config.
|
||||
// Init inits connection writer with json config.
|
||||
// json config only need key "level".
|
||||
func (cw *ConnWriter) Init(jsonconfig string) error {
|
||||
return json.Unmarshal([]byte(jsonconfig), cw)
|
||||
}
|
||||
|
||||
// write message in connection.
|
||||
// WriteMsg writes message in connection.
|
||||
// if connection is down, try to re-connect.
|
||||
func (cw *ConnWriter) WriteMsg(msg string, skip, level int) error {
|
||||
if cw.Level > level {
|
||||
|
@ -55,10 +55,11 @@ func (cw *ConnWriter) WriteMsg(msg string, skip, level int) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (_ *ConnWriter) Flush() {
|
||||
// Flush no things for this implementation
|
||||
func (cw *ConnWriter) Flush() {
|
||||
}
|
||||
|
||||
// destroy connection writer and close tcp listener.
|
||||
// Destroy destroy connection writer and close tcp listener.
|
||||
func (cw *ConnWriter) Destroy() {
|
||||
if cw.innerWriter == nil {
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue