forked from External/ergo
logger: Move to separate package, make *much* nicer
This commit is contained in:
parent
ef9acf53f8
commit
439331cfb8
6 changed files with 160 additions and 86 deletions
|
|
@ -170,7 +170,7 @@ func (client *Client) run() {
|
|||
|
||||
maxlenTags, maxlenRest := client.maxlens()
|
||||
|
||||
client.server.logger.Log(LogDebug, "userinput ", client.nick, "<- ", line)
|
||||
client.server.logger.Debug("userinput ", client.nick, "<- ", line)
|
||||
|
||||
msg, err = ircmsg.ParseLineMaxLen(line, maxlenTags, maxlenRest)
|
||||
if err == ircmsg.ErrorLineIsEmpty {
|
||||
|
|
@ -404,7 +404,7 @@ func (client *Client) AllNickmasks() []string {
|
|||
// SetNickname sets the very first nickname for the client.
|
||||
func (client *Client) SetNickname(nickname string) error {
|
||||
if client.HasNick() {
|
||||
client.server.logger.Log(LogError, "nick", fmt.Sprintf("%s nickname already set, something is wrong with server consistency", client.nickMaskString))
|
||||
client.server.logger.Error("nick", fmt.Sprintf("%s nickname already set, something is wrong with server consistency", client.nickMaskString))
|
||||
return ErrNickAlreadySet
|
||||
}
|
||||
|
||||
|
|
@ -421,7 +421,7 @@ func (client *Client) ChangeNickname(nickname string) error {
|
|||
origNickMask := client.nickMaskString
|
||||
err := client.server.clients.Replace(client.nick, nickname, client)
|
||||
if err == nil {
|
||||
client.server.logger.Log(LogDebug, "nick", fmt.Sprintf("%s changed nickname to %s", client.nick, nickname))
|
||||
client.server.logger.Debug("nick", fmt.Sprintf("%s changed nickname to %s", client.nick, nickname))
|
||||
client.server.whoWas.Append(client)
|
||||
client.nick = nickname
|
||||
client.updateNickMask()
|
||||
|
|
@ -446,7 +446,7 @@ func (client *Client) destroy() {
|
|||
return
|
||||
}
|
||||
|
||||
client.server.logger.Log(LogDebug, "quit", fmt.Sprintf("%s is no longer on the server", client.nick))
|
||||
client.server.logger.Debug("quit", fmt.Sprintf("%s is no longer on the server", client.nick))
|
||||
|
||||
// send quit/error message to client if they haven't been sent already
|
||||
client.Quit("Connection closed")
|
||||
|
|
@ -595,7 +595,7 @@ func (client *Client) Send(tags *map[string]ircmsg.TagValue, prefix string, comm
|
|||
line = line[:len(line)-3] + "\r\n"
|
||||
}
|
||||
|
||||
client.server.logger.Log(LogDebug, "useroutput", client.nick, " ->", strings.TrimRight(line, "\r\n"))
|
||||
client.server.logger.Debug("useroutput", client.nick, " ->", strings.TrimRight(line, "\r\n"))
|
||||
|
||||
client.socket.Write(line)
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue