mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-18 05:02:15 +01:00
better debug logs for Markdown printer
This commit is contained in:
@@ -28,12 +28,14 @@ func NewMarkdownPrinter(logger xlog.Logger, fpath string, opts ChromePrinterOpti
|
|||||||
}
|
}
|
||||||
dirPath := filepath.Dir(fpath)
|
dirPath := filepath.Dir(fpath)
|
||||||
data := &templateData{DirPath: dirPath}
|
data := &templateData{DirPath: dirPath}
|
||||||
|
logger.DebugOp(op, "converting Markdown files to HTML...")
|
||||||
var buffer bytes.Buffer
|
var buffer bytes.Buffer
|
||||||
if err := tmpl.Execute(&buffer, data); err != nil {
|
if err := tmpl.Execute(&buffer, data); err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
baseFilename := xrand.Get()
|
baseFilename := xrand.Get()
|
||||||
dst := fmt.Sprintf("%s/%s.html", dirPath, baseFilename)
|
dst := fmt.Sprintf("%s/%s.html", dirPath, baseFilename)
|
||||||
|
logger.DebugOp(op, "writing the HTML from previous conversion into new file...")
|
||||||
if err := ioutil.WriteFile(dst, buffer.Bytes(), 0644); err != nil {
|
if err := ioutil.WriteFile(dst, buffer.Bytes(), 0644); err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user