1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-19 05:09:42 +02:00

wrap errors up, log at top level only

This commit is contained in:
Harvey Kandola 2017-08-03 10:00:24 +01:00
parent ecc94f31c9
commit 476403bf46
28 changed files with 899 additions and 804 deletions

View file

@ -17,7 +17,6 @@ import (
"strings"
api "github.com/documize/community/core/convapi"
"github.com/documize/community/core/log"
"github.com/documize/community/core/stringutil"
"golang.org/x/net/context"
"golang.org/x/net/html"
@ -192,7 +191,6 @@ func (h *htmlToSplit) renderAppend(c *html.Node) error {
ebyt := stringutil.EscapeHTMLcomplexCharsByte(byt)
if len(ebyt) > maxBody {
msg := fmt.Sprintf("(Documize warning: HTML render element ignored, size of %d exceeded maxBody of %d.)", len(ebyt), maxBody)
log.Info(msg)
ebyt = []byte("<p><b>" + msg + "</b></p>")
}
if len(h.thisSect.Body)+len(ebyt) > maxBody {

View file

@ -22,7 +22,6 @@ import (
"github.com/documize/community/core/api/convert/html"
"github.com/documize/community/core/api/convert/md"
api "github.com/documize/community/core/convapi"
"github.com/documize/community/core/log"
"github.com/documize/community/domain"
"github.com/documize/glick"
)
@ -34,14 +33,14 @@ var insecure = "false"
type infoLog struct{}
func (i infoLog) Write(b []byte) (int, error) {
log.Info(string(b))
// log.Info(string(b))
return len(b), nil
}
type errorLog struct{}
func (i errorLog) Write(b []byte) (int, error) {
log.ErrorString(string(b))
// log.ErrorString(string(b))
return len(b), nil
}
@ -107,7 +106,6 @@ func Setup(s *domain.Store) error {
} else {
json, err = ioutil.ReadFile(PluginFile)
if err != nil {
log.Info("Plugin file '" + PluginFile + "' not found, using no plugins")
json = []byte(" [ ] \n")
err = nil
}