1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-19 05:09: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
}
runtime.Log.Info(fmt.Sprintf("Database: loaded %d SQL scripts for provider %s", len(dbTypeScripts), runtime.Storage.Type))
// Get current database version.
currentVersion := 0
if existingDB {
@ -63,7 +65,7 @@ func InstallUpgrade(runtime *env.Runtime, existingDB bool) (err error) {
var err error
amLeader, err = Lock(runtime, len(toProcess))
if err != nil {
runtime.Log.Error("unable to lock DB", err)
runtime.Log.Error("Database: failed to lock existing database for processing", err)
}
} else {
// 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.
tx, err := runtime.Db.Beginx()
if err != nil {
runtime.Log.Error("Database: unable to start transaction", err)
return false, err
}
// Lock the database.
_, err = tx.Exec(processLockStartQuery(runtime.Storage.Type))
if err != nil {
runtime.Log.Error("Database: unable to lock tables", 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 err == nil {
tx.Commit()
runtime.Log.Info("Database: ready")
runtime.Log.Info("Database: is ready")
return nil
}
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})
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.
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
switch rt.Flags.SiteMode {
@ -47,7 +47,7 @@ func Start(rt *env.Runtime, s *domain.Store, ready chan struct{}) {
if err != nil {
rt.Log.Error("plugin setup failed", err)
}
rt.Log.Info("Starting web server")
rt.Log.Info("Web Server: starting up")
}
// define middleware
@ -88,7 +88,7 @@ func Start(rt *env.Runtime, s *domain.Store, ready chan struct{}) {
// start server
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 {
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))
@ -98,7 +98,7 @@ func Start(rt *env.Runtime, s *domain.Store, ready chan struct{}) {
n.Run(testHost + ":" + rt.Flags.HTTPPort)
} else {
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() {
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("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/