Browse Source

logger: Add notice on connection when server is logging all I/O

tags/v0.7.0
Daniel Oaks 7 years ago
parent
commit
25a373b7eb
2 changed files with 8 additions and 1 deletions
  1. 5
    1
      irc/logger.go
  2. 3
    0
      irc/server.go

+ 5
- 1
irc/logger.go View File

@@ -48,7 +48,8 @@ var (
48 48
 
49 49
 // Logger is the main interface used to log debug/info/error messages.
50 50
 type Logger struct {
51
-	loggers []SingleLogger
51
+	loggers         []SingleLogger
52
+	DumpingRawInOut bool
52 53
 }
53 54
 
54 55
 // NewLogger returns a new Logger.
@@ -66,6 +67,9 @@ func NewLogger(config []LoggingConfig) (*Logger, error) {
66 67
 			Types:         logConfig.Types,
67 68
 			ExcludedTypes: logConfig.ExcludedTypes,
68 69
 		}
70
+		if logConfig.Types["userinput"] || logConfig.Types["useroutput"] || (logConfig.Types["*"] && !(logConfig.ExcludedTypes["userinput"] && logConfig.ExcludedTypes["useroutput"])) {
71
+			logger.DumpingRawInOut = true
72
+		}
69 73
 		if sLogger.MethodFile.Enabled {
70 74
 			file, err := os.OpenFile(sLogger.MethodFile.Filename, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0666)
71 75
 			if err != nil {

+ 3
- 0
irc/server.go View File

@@ -658,6 +658,9 @@ func (server *Server) tryRegister(c *Client) {
658 658
 	c.RplISupport()
659 659
 	server.MOTD(c)
660 660
 	c.Send(nil, c.nickMaskString, RPL_UMODEIS, c.nick, c.ModeString())
661
+	if server.logger.DumpingRawInOut {
662
+		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.")
663
+	}
661 664
 }
662 665
 
663 666
 // MOTD serves the Message of the Day.

Loading…
Cancel
Save