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

Boot process logger message consistency and improvements

This commit is contained in:
Harvey Kandola 2018-09-14 13:00:58 +01:00
parent 2336dab69f
commit 4c733ce581
4 changed files with 12 additions and 8 deletions

View file

@ -39,6 +39,8 @@ func InstallUpgrade(runtime *env.Runtime, existingDB bool) (err error) {
return return
} }
runtime.Log.Info(fmt.Sprintf("Database: loaded %d SQL scripts for provider %s", len(dbTypeScripts), runtime.Storage.Type))
// Get current database version. // Get current database version.
currentVersion := 0 currentVersion := 0
if existingDB { if existingDB {
@ -63,7 +65,7 @@ func InstallUpgrade(runtime *env.Runtime, existingDB bool) (err error) {
var err error var err error
amLeader, err = Lock(runtime, len(toProcess)) amLeader, err = Lock(runtime, len(toProcess))
if err != nil { if err != nil {
runtime.Log.Error("unable to lock DB", err) runtime.Log.Error("Database: failed to lock existing database for processing", err)
} }
} else { } else {
// New installation hopes that you are only spinning up one instance of Documize. // New installation hopes that you are only spinning up one instance of Documize.

View file

@ -43,12 +43,14 @@ func Lock(runtime *env.Runtime, scriptsToProcess int) (bool, error) {
// Start transaction fotr lock process. // Start transaction fotr lock process.
tx, err := runtime.Db.Beginx() tx, err := runtime.Db.Beginx()
if err != nil { if err != nil {
runtime.Log.Error("Database: unable to start transaction", err)
return false, err return false, err
} }
// Lock the database. // Lock the database.
_, err = tx.Exec(processLockStartQuery(runtime.Storage.Type)) _, err = tx.Exec(processLockStartQuery(runtime.Storage.Type))
if err != nil { if err != nil {
runtime.Log.Error("Database: unable to lock tables", err)
return false, err return false, err
} }
@ -83,7 +85,7 @@ func Unlock(runtime *env.Runtime, tx *sqlx.Tx, err error, amLeader bool) error {
if tx != nil { if tx != nil {
if err == nil { if err == nil {
tx.Commit() tx.Commit()
runtime.Log.Info("Database: ready") runtime.Log.Info("Database: is ready")
return nil return nil
} }
tx.Rollback() tx.Rollback()

View file

@ -47,5 +47,5 @@ func Register(rt *env.Runtime, s *domain.Store) {
provider.Register("flowchart", &flowchart.Provider{Runtime: rt, Store: s}) provider.Register("flowchart", &flowchart.Provider{Runtime: rt, Store: s})
p := provider.List() p := provider.List()
rt.Log.Info(fmt.Sprintf("Registered %d sections", len(p))) rt.Log.Info(fmt.Sprintf("Extensions: registered %d section types", len(p)))
} }

View file

@ -30,7 +30,7 @@ var testHost string // used during automated testing
// Start router to handle all HTTP traffic. // Start router to handle all HTTP traffic.
func Start(rt *env.Runtime, s *domain.Store, ready chan struct{}) { func Start(rt *env.Runtime, s *domain.Store, ready chan struct{}) {
rt.Log.Info(fmt.Sprintf("Starting %s version %s", rt.Product.Title, rt.Product.Version)) rt.Log.Info(fmt.Sprintf("Edition: %s version %s", rt.Product.Title, rt.Product.Version))
// decide which mode to serve up // decide which mode to serve up
switch rt.Flags.SiteMode { switch rt.Flags.SiteMode {
@ -47,7 +47,7 @@ func Start(rt *env.Runtime, s *domain.Store, ready chan struct{}) {
if err != nil { if err != nil {
rt.Log.Error("plugin setup failed", err) rt.Log.Error("plugin setup failed", err)
} }
rt.Log.Info("Starting web server") rt.Log.Info("Web Server: starting up")
} }
// define middleware // define middleware
@ -88,7 +88,7 @@ func Start(rt *env.Runtime, s *domain.Store, ready chan struct{}) {
// start server // start server
if !rt.Flags.SSLEnabled() { if !rt.Flags.SSLEnabled() {
rt.Log.Info("Starting non-SSL server on " + rt.Flags.HTTPPort) rt.Log.Info("Web Server: binding non-SSL server on " + rt.Flags.HTTPPort)
if rt.Flags.SiteMode == env.SiteModeSetup { if rt.Flags.SiteMode == env.SiteModeSetup {
rt.Log.Info("***") rt.Log.Info("***")
rt.Log.Info(fmt.Sprintf("*** Go to http://localhost:%s/setup in your web browser and complete setup wizard ***", rt.Flags.HTTPPort)) rt.Log.Info(fmt.Sprintf("*** Go to http://localhost:%s/setup in your web browser and complete setup wizard ***", rt.Flags.HTTPPort))
@ -98,7 +98,7 @@ func Start(rt *env.Runtime, s *domain.Store, ready chan struct{}) {
n.Run(testHost + ":" + rt.Flags.HTTPPort) n.Run(testHost + ":" + rt.Flags.HTTPPort)
} else { } else {
if rt.Flags.ForceHTTPPort2SSL != "" { if rt.Flags.ForceHTTPPort2SSL != "" {
rt.Log.Info("Starting non-SSL server on " + rt.Flags.ForceHTTPPort2SSL + " and redirecting to SSL server on " + rt.Flags.HTTPPort) rt.Log.Info("Web Server: binding non-SSL server on " + rt.Flags.ForceHTTPPort2SSL + " and redirecting to SSL server on " + rt.Flags.HTTPPort)
go func() { go func() {
err := http.ListenAndServe(":"+rt.Flags.ForceHTTPPort2SSL, http.HandlerFunc( err := http.ListenAndServe(":"+rt.Flags.ForceHTTPPort2SSL, http.HandlerFunc(
@ -119,7 +119,7 @@ func Start(rt *env.Runtime, s *domain.Store, ready chan struct{}) {
rt.Log.Info("***") rt.Log.Info("***")
} }
rt.Log.Info("Starting SSL server on " + rt.Flags.HTTPPort + " with " + rt.Flags.SSLCertFile + " " + rt.Flags.SSLKeyFile) rt.Log.Info("Web Server: starting SSL server on " + rt.Flags.HTTPPort + " with " + rt.Flags.SSLCertFile + " " + rt.Flags.SSLKeyFile)
// TODO: https://blog.gopheracademy.com/advent-2016/exposing-go-on-the-internet/ // TODO: https://blog.gopheracademy.com/advent-2016/exposing-go-on-the-internet/