mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-22 20:09:41 +01:00
logger: Add notice on connection when server is logging all I/O
This commit is contained in:
parent
f1bf73c249
commit
25a373b7eb
@ -49,6 +49,7 @@ var (
|
||||
// Logger is the main interface used to log debug/info/error messages.
|
||||
type Logger struct {
|
||||
loggers []SingleLogger
|
||||
DumpingRawInOut bool
|
||||
}
|
||||
|
||||
// NewLogger returns a new Logger.
|
||||
@ -66,6 +67,9 @@ func NewLogger(config []LoggingConfig) (*Logger, error) {
|
||||
Types: logConfig.Types,
|
||||
ExcludedTypes: logConfig.ExcludedTypes,
|
||||
}
|
||||
if logConfig.Types["userinput"] || logConfig.Types["useroutput"] || (logConfig.Types["*"] && !(logConfig.ExcludedTypes["userinput"] && logConfig.ExcludedTypes["useroutput"])) {
|
||||
logger.DumpingRawInOut = true
|
||||
}
|
||||
if sLogger.MethodFile.Enabled {
|
||||
file, err := os.OpenFile(sLogger.MethodFile.Filename, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0666)
|
||||
if err != nil {
|
||||
|
@ -658,6 +658,9 @@ func (server *Server) tryRegister(c *Client) {
|
||||
c.RplISupport()
|
||||
server.MOTD(c)
|
||||
c.Send(nil, c.nickMaskString, RPL_UMODEIS, c.nick, c.ModeString())
|
||||
if server.logger.DumpingRawInOut {
|
||||
c.Notice("This server is in debug mode and is logging all user I/O. If you do not wish for everything you send to be readable by the server owner(s), please disconnect.")
|
||||
}
|
||||
}
|
||||
|
||||
// MOTD serves the Message of the Day.
|
||||
|
Loading…
Reference in New Issue
Block a user