From bb8b5534d2d631fcd523cfaab2ec5071a8049175 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Sat, 26 Sep 2015 15:40:05 +0800 Subject: [PATCH] More pretty logging and doc --- main.go | 3 ++- output/processes.go | 6 +++--- output/run.go | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index d5c0104..cd8c08b 100644 --- a/main.go +++ b/main.go @@ -88,7 +88,8 @@ func init() { session.FixedTimeReport() } - logger.Debug("cross-compilation ", util.Go.GetCrossPlatforms()) + logger.Debug("host ["+runtime.Version()+", "+runtime.GOOS+"_"+runtime.GOARCH+ + "], cross-compilation ", util.Go.GetCrossPlatforms()) } // Main. diff --git a/output/processes.go b/output/processes.go index 686ecc7..edab534 100644 --- a/output/processes.go +++ b/output/processes.go @@ -32,7 +32,7 @@ var Processes = procs{} // Exclusive lock. var mutex sync.Mutex -// add adds the specified process to the user process set. +// Add adds the specified process to the user process set. func (procs *procs) Add(wSession *session.WideSession, proc *os.Process) { mutex.Lock() defer mutex.Unlock() @@ -49,7 +49,7 @@ func (procs *procs) Add(wSession *session.WideSession, proc *os.Process) { logger.Tracef("Session [%s] has [%d] processes", sid, len((*procs)[sid])) } -// remove removes the specified process from the user process set. +// Remove removes the specified process from the user process set. func (procs *procs) Remove(wSession *session.WideSession, proc *os.Process) { mutex.Lock() defer mutex.Unlock() @@ -74,7 +74,7 @@ func (procs *procs) Remove(wSession *session.WideSession, proc *os.Process) { } } -// kill kills a process specified by the given pid. +// Kill kills a process specified by the given pid. func (procs *procs) Kill(wSession *session.WideSession, pid int) { mutex.Lock() defer mutex.Unlock() diff --git a/output/run.go b/output/run.go index 9cdab5a..0dea317 100644 --- a/output/run.go +++ b/output/run.go @@ -149,7 +149,8 @@ func RunHandler(w http.ResponseWriter, r *http.Request) { // remove the exited process from user's process set Processes.Remove(wSession, cmd.Process) - logger.Debugf("User [%s, %s] 's running [id=%d, file=%s] has done [stdout %v], ", wSession.Username, sid, runningId, filePath, err) + logger.Debugf("User [%s, %s] 's running [id=%d, file=%s] has done [stdout %v], ", + wSession.Username, sid, runningId, filePath, err) channelRet["cmd"] = "run-done" channelRet["output"] = buf.content