improving logging

This commit is contained in:
Julien Neuhart
2019-07-08 11:06:26 +02:00
parent 5af01505c2
commit 70b185a37a
11 changed files with 49 additions and 28 deletions

View File

@@ -9,7 +9,7 @@ import (
"github.com/thecodingmachine/gotenberg/internal/pkg/standarderror"
)
const warmupTime = 10 * time.Second
const chromeWarmupTime = 10 * time.Second
type chrome struct {
manager *processManager
@@ -93,13 +93,13 @@ func (p *chrome) viable() bool {
}
func (p *chrome) warmup() {
const debugOp = "pm2.chrome.warmup"
const op = "pm2.chrome.warmup"
p.manager.logger.DebugfOp(
debugOp,
op,
"allowing %v to startup",
warmupTime,
chromeWarmupTime,
)
time.Sleep(warmupTime)
time.Sleep(chromeWarmupTime)
}
// Compile-time checks to ensure type implements desired interfaces.

View File

@@ -1,10 +1,14 @@
package pm2
import (
"time"
"github.com/thecodingmachine/gotenberg/internal/pkg/logger"
"github.com/thecodingmachine/gotenberg/internal/pkg/standarderror"
)
const unoconvWarmupTime = 5 * time.Second
type unoconv struct {
manager *processManager
}
@@ -56,7 +60,13 @@ func (p *unoconv) viable() bool {
}
func (p *unoconv) warmup() {
// let's do nothing.
const op = "pm2.unoconv.warmup"
p.manager.logger.DebugfOp(
op,
"allowing %v to startup",
unoconvWarmupTime,
)
time.Sleep(unoconvWarmupTime)
}
// Compile-time checks to ensure type implements desired interfaces.