mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-15 11:52:14 +01:00
wip refactoring: better logging and error systems
This commit is contained in:
@@ -5,7 +5,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/mafredri/cdp/devtool"
|
||||
log "github.com/thecodingmachine/gotenberg/internal/pkg/logger"
|
||||
"github.com/thecodingmachine/gotenberg/internal/pkg/logger"
|
||||
)
|
||||
|
||||
const warmupTime = 10 * time.Second
|
||||
@@ -16,7 +16,7 @@ type chrome struct {
|
||||
|
||||
// NewChrome returns a Google Chrome
|
||||
// headless process.
|
||||
func NewChrome(logger *log.StandardLogger) Process {
|
||||
func NewChrome(logger *logger.Logger) Process {
|
||||
return &chrome{
|
||||
manager: &processManager{logger: logger},
|
||||
}
|
||||
@@ -61,7 +61,10 @@ func (p *chrome) viable() bool {
|
||||
// check if Google Chrome is correctly running.
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
p.manager.logger.Debugf("%s: checking liveness via debug version endpoint http://localhost:9222/json/version", p.Fullname())
|
||||
p.manager.logger.Debugf(
|
||||
"%s: checking liveness via debug version endpoint http://localhost:9222/json/version",
|
||||
p.Fullname(),
|
||||
)
|
||||
v, err := devtool.New("http://localhost:9222").Version(ctx)
|
||||
if err != nil {
|
||||
p.manager.logger.Debugf("%s: debug version endpoint returned error: %v", p.Fullname(), err)
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
log "github.com/thecodingmachine/gotenberg/internal/pkg/logger"
|
||||
"github.com/thecodingmachine/gotenberg/internal/pkg/logger"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -30,7 +30,7 @@ type Process interface {
|
||||
|
||||
type processManager struct {
|
||||
heuristicState int32
|
||||
logger *log.StandardLogger
|
||||
logger *logger.Logger
|
||||
}
|
||||
|
||||
func (m *processManager) start(p Process) error {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package pm2
|
||||
|
||||
import (
|
||||
log "github.com/thecodingmachine/gotenberg/internal/pkg/logger"
|
||||
"github.com/thecodingmachine/gotenberg/internal/pkg/logger"
|
||||
)
|
||||
|
||||
type unoconv struct {
|
||||
@@ -10,7 +10,7 @@ type unoconv struct {
|
||||
|
||||
// NewUnoconv returns a unoconv listener
|
||||
// process.
|
||||
func NewUnoconv(logger *log.StandardLogger) Process {
|
||||
func NewUnoconv(logger *logger.Logger) Process {
|
||||
return &unoconv{
|
||||
manager: &processManager{logger: logger},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user