diff options
| author | Shulhan <ms@kilabit.info> | 2023-10-13 15:18:09 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2023-10-13 15:18:09 +0700 |
| commit | aa5ec477dceb0283fc1eca05eb4fdd0c8b7d41a1 (patch) | |
| tree | 230c48f7f3abfb9340c5d58c00f47a5cf4d5cfe7 | |
| parent | 4d6bb569fd00678a7b488725ed4d1ba998b47d54 (diff) | |
| download | ciigo-aa5ec477dceb0283fc1eca05eb4fdd0c8b7d41a1.tar.xz | |
all: print log message with log package
This is to provide the timestamp to each log output.
| -rw-r--r-- | converter.go | 2 | ||||
| -rw-r--r-- | server.go | 3 | ||||
| -rw-r--r-- | watcher.go | 13 |
3 files changed, 9 insertions, 9 deletions
diff --git a/converter.go b/converter.go index da78cb4..316bfc5 100644 --- a/converter.go +++ b/converter.go @@ -84,7 +84,7 @@ func (converter *Converter) convertFileMarkups(fileMarkups map[string]*FileMarku if err != nil { log.Printf(`%s: %s`, logp, err) } else { - fmt.Printf("%s: converting %s\n", logp, fmarkup.path) + log.Printf(`%s: converting %s`, logp, fmarkup.path) } } } @@ -7,6 +7,7 @@ import ( "bytes" "fmt" "html/template" + "log" "strings" libhttp "github.com/shuLhan/share/lib/http" @@ -120,7 +121,7 @@ func (srv *server) start() (err error) { } } - fmt.Printf("ciigo: starting HTTP server at http://%s for %q\n", + log.Printf(`ciigo: starting HTTP server at http://%s for %q`, srv.http.Options.Address, srv.http.Options.Memfs.Opts.Root) err = srv.http.Start() @@ -121,7 +121,7 @@ func (w *watcher) watchFileMarkup() { switch ns.State { case memfs.FileStateDeleted: - fmt.Printf("%s: %q deleted\n", logp, ns.Node.SysPath) + log.Printf(`%s: %q deleted`, logp, ns.Node.SysPath) fmarkup, ok = w.fileMarkups[ns.Node.SysPath] if ok { delete(w.fileMarkups, ns.Node.SysPath) @@ -130,7 +130,7 @@ func (w *watcher) watchFileMarkup() { continue case memfs.FileStateCreated: - fmt.Printf("%s: %s created\n", logp, ns.Node.SysPath) + log.Printf(`%s: %s created`, logp, ns.Node.SysPath) fmarkup, err = NewFileMarkup(ns.Node.SysPath, nil) if err != nil { log.Printf("%s: %s\n", logp, err) @@ -140,11 +140,11 @@ func (w *watcher) watchFileMarkup() { w.fileMarkups[ns.Node.SysPath] = fmarkup case memfs.FileStateUpdateMode: - fmt.Printf("%s: %s mode updated\n", logp, ns.Node.SysPath) + log.Printf(`%s: %s mode updated`, logp, ns.Node.SysPath) continue case memfs.FileStateUpdateContent: - fmt.Printf("%s: %s content updated\n", logp, ns.Node.SysPath) + log.Printf(`%s: %s content updated`, logp, ns.Node.SysPath) fmarkup = w.fileMarkups[ns.Node.SysPath] if fmarkup == nil { log.Printf("%s: %s not found\n", logp, ns.Node.SysPath) @@ -184,8 +184,7 @@ func (w *watcher) watchHtmlTemplate() { logp, ns.Node.SysPath) err = w.converter.htmlTemplateUseInternal() } else { - fmt.Printf("%s: recompiling HTML template %q ...\n", logp, - ns.Node.SysPath) + log.Printf(`%s: recompiling HTML template %q ...`, logp, ns.Node.SysPath) err = w.converter.SetHtmlTemplateFile(w.converter.htmlTemplate) } if err != nil { @@ -193,7 +192,7 @@ func (w *watcher) watchHtmlTemplate() { continue } - fmt.Printf("%s: regenerate all markup files ...\n", logp) + log.Printf(`%s: regenerate all markup files ...`, logp) w.converter.convertFileMarkups(w.fileMarkups, true) } } |
