Skip to content

Commit

Permalink
[add] session debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
trheyi committed Oct 10, 2023
1 parent 7a1d10d commit 3b7edbf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions session/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"time"

"github.com/yaoapp/gou/process"
"github.com/yaoapp/kun/log"
)

// SessionHandlers 模型运行器
Expand Down Expand Up @@ -65,14 +66,17 @@ func processSet(process *process.Process) interface{} {
process.ValidateArgNums(2)
ss := setSession(process)
if process.NumOfArgs() == 3 {
log.Debug("set session KEY: %s, VALUE: %v, TS: %d", process.ArgsString(0), process.Args[1], process.ArgsInt(2))
ss.MustSetWithEx(process.ArgsString(0), process.Args[1], time.Duration(process.ArgsInt(2))*time.Second)
return nil

} else if process.NumOfArgs() == 4 {
log.Debug("set session ID: %s KEY: %s, VALUE: %v, TS: %d", process.ArgsString(3), process.ArgsString(0), process.Args[1], process.ArgsInt(2))
ss = Global().ID(process.ArgsString(3))
ss.MustSetWithEx(process.ArgsString(0), process.Args[1], time.Duration(process.ArgsInt(2))*time.Second)
}

log.Debug("set session KEY: %s, VALUE: %v", process.ArgsString(0), process.Args[1])
ss.MustSet(process.ArgsString(0), process.Args[1])
return nil
}
Expand Down

0 comments on commit 3b7edbf

Please sign in to comment.