@@ -50,6 +50,8 @@ type logMessage struct {
5050 arg4 any
5151 arg5 any
5252 arg6 any
53+ arg7 any
54+ arg8 any
5355}
5456
5557// Logger is a high-performance, non-blocking logger
@@ -94,7 +96,6 @@ func (l *Logger) SetLevel(level Level) {
9496 log .Debugf ("Set uspfilter logger loglevel to %v" , levelStrings [level ])
9597}
9698
97-
9899func (l * Logger ) Error (format string ) {
99100 if l .level .Load () >= uint32 (LevelError ) {
100101 select {
@@ -185,6 +186,15 @@ func (l *Logger) Debug2(format string, arg1, arg2 any) {
185186 }
186187}
187188
189+ func (l * Logger ) Debug3 (format string , arg1 , arg2 , arg3 any ) {
190+ if l .level .Load () >= uint32 (LevelDebug ) {
191+ select {
192+ case l .msgChannel <- logMessage {level : LevelDebug , format : format , arg1 : arg1 , arg2 : arg2 , arg3 : arg3 }:
193+ default :
194+ }
195+ }
196+ }
197+
188198func (l * Logger ) Trace1 (format string , arg1 any ) {
189199 if l .level .Load () >= uint32 (LevelTrace ) {
190200 select {
@@ -239,6 +249,16 @@ func (l *Logger) Trace6(format string, arg1, arg2, arg3, arg4, arg5, arg6 any) {
239249 }
240250}
241251
252+ // Trace8 logs a trace message with 8 arguments (8 placeholder in format string)
253+ func (l * Logger ) Trace8 (format string , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 any ) {
254+ if l .level .Load () >= uint32 (LevelTrace ) {
255+ select {
256+ case l .msgChannel <- logMessage {level : LevelTrace , format : format , arg1 : arg1 , arg2 : arg2 , arg3 : arg3 , arg4 : arg4 , arg5 : arg5 , arg6 : arg6 , arg7 : arg7 , arg8 : arg8 }:
257+ default :
258+ }
259+ }
260+ }
261+
242262func (l * Logger ) formatMessage (buf * []byte , msg logMessage ) {
243263 * buf = (* buf )[:0 ]
244264 * buf = time .Now ().AppendFormat (* buf , "2006-01-02T15:04:05-07:00" )
@@ -260,6 +280,12 @@ func (l *Logger) formatMessage(buf *[]byte, msg logMessage) {
260280 argCount ++
261281 if msg .arg6 != nil {
262282 argCount ++
283+ if msg .arg7 != nil {
284+ argCount ++
285+ if msg .arg8 != nil {
286+ argCount ++
287+ }
288+ }
263289 }
264290 }
265291 }
@@ -283,6 +309,10 @@ func (l *Logger) formatMessage(buf *[]byte, msg logMessage) {
283309 formatted = fmt .Sprintf (msg .format , msg .arg1 , msg .arg2 , msg .arg3 , msg .arg4 , msg .arg5 )
284310 case 6 :
285311 formatted = fmt .Sprintf (msg .format , msg .arg1 , msg .arg2 , msg .arg3 , msg .arg4 , msg .arg5 , msg .arg6 )
312+ case 7 :
313+ formatted = fmt .Sprintf (msg .format , msg .arg1 , msg .arg2 , msg .arg3 , msg .arg4 , msg .arg5 , msg .arg6 , msg .arg7 )
314+ case 8 :
315+ formatted = fmt .Sprintf (msg .format , msg .arg1 , msg .arg2 , msg .arg3 , msg .arg4 , msg .arg5 , msg .arg6 , msg .arg7 , msg .arg8 )
286316 }
287317
288318 * buf = append (* buf , formatted ... )
@@ -390,4 +420,4 @@ func (l *Logger) Stop(ctx context.Context) error {
390420 case <- done :
391421 return nil
392422 }
393- }
423+ }
0 commit comments