mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-13 07:29:30 +01:00
logger: Add notice on connection when server is logging all I/O
This commit is contained in:
parent
f1bf73c249
commit
25a373b7eb
@ -48,7 +48,8 @@ var (
|
|||||||
|
|
||||||
// Logger is the main interface used to log debug/info/error messages.
|
// Logger is the main interface used to log debug/info/error messages.
|
||||||
type Logger struct {
|
type Logger struct {
|
||||||
loggers []SingleLogger
|
loggers []SingleLogger
|
||||||
|
DumpingRawInOut bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewLogger returns a new Logger.
|
// NewLogger returns a new Logger.
|
||||||
@ -66,6 +67,9 @@ func NewLogger(config []LoggingConfig) (*Logger, error) {
|
|||||||
Types: logConfig.Types,
|
Types: logConfig.Types,
|
||||||
ExcludedTypes: logConfig.ExcludedTypes,
|
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 {
|
if sLogger.MethodFile.Enabled {
|
||||||
file, err := os.OpenFile(sLogger.MethodFile.Filename, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0666)
|
file, err := os.OpenFile(sLogger.MethodFile.Filename, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0666)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -658,6 +658,9 @@ func (server *Server) tryRegister(c *Client) {
|
|||||||
c.RplISupport()
|
c.RplISupport()
|
||||||
server.MOTD(c)
|
server.MOTD(c)
|
||||||
c.Send(nil, c.nickMaskString, RPL_UMODEIS, c.nick, c.ModeString())
|
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.
|
// MOTD serves the Message of the Day.
|
||||||
|
Loading…
Reference in New Issue
Block a user