AFAIRE
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
logger/format.go

39 lines
903 B

/*
------------------------------------------------------------------------------------------------------------------------
####### logger ####### Copyright (c) 2021 losyme ################################################### MIT License #######
------------------------------------------------------------------------------------------------------------------------
*/
package logger
import (
"fmt"
"forge.chapril.org/losyme/buffer"
)
const (
_maxIDLen = 8
_maxNameLen = 10
)
const _bufSize = 256
var BufPool = buffer.NewPool(_bufSize)
func loggerLabel(id, name string) string {
if len(name) > _maxNameLen {
name = name[:_maxNameLen]
}
if len(id) > _maxIDLen {
id = id[:_maxIDLen]
}
return fmt.Sprintf("%*s:%*s", _maxNameLen, name, _maxIDLen, id)
}
/*
######################################################################################################## @(°_°)@ #######
*/