diff --git a/dlog.go b/dlog.go index 8389961..dfd3078 100644 --- a/dlog.go +++ b/dlog.go @@ -30,10 +30,16 @@ func (s *GoServer) hasScratch() bool { } +func (s *GoServer) DLog(text string) { + if s.dlogHandle != nil { + s.dlogHandle.WriteString(fmt.Sprintf("%v %v\n", time.Now().Unix(), text)) + } +} + func (s *GoServer) prepDLog() { if s.hasScratch() { filename := fmt.Sprintf("/media/scratch/dlogs/%v/%v.logs", s.Registry.GetName(), time.Now().Unix()) - os.MkdirAll(fmt.Sprintf("/media/scratch/dlogs/%v-dlogs/", s.Registry.GetName()), 0777) + os.MkdirAll(fmt.Sprintf("/media/scratch/dlogs/%v/", s.Registry.GetName()), 0777) fhandle, err := os.Create(filename) if err != nil { s.Log(fmt.Sprintf("Unable to open file: %v", err)) diff --git a/goserverapi.go b/goserverapi.go index c3a6e6e..4b1a0e0 100644 --- a/goserverapi.go +++ b/goserverapi.go @@ -1345,6 +1345,11 @@ func (s *GoServer) SendCrash(ctx context.Context, crashText string, ctype pbbs.C //PLog a simple string message with priority func (s *GoServer) PLog(message string, level pbd.LogLevel) { + if !s.SkipLog { + go func() { + s.DLog(message) + }() + } go func() { if !s.SkipLog && s.Registry != nil { ctx, cancel := utils.ManualContext(s.Registry.GetName(), "logging", time.Second, false)