-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
app.go
41 lines (34 loc) · 838 Bytes
/
app.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import (
"context"
slog "log/slog"
"github.com/marcus-crane/october/backend"
)
// App struct
type App struct {
ctx context.Context
logger *slog.Logger
portable bool
}
// NewApp creates a new App application struct
func NewApp(portable bool, logger *slog.Logger) *App {
logger.Debug("Initialising app struct")
return &App{
logger: logger,
portable: portable,
}
}
// startup is called when the app starts. The context is saved
// so we can call the runtime methods
func (a *App) startup(ctx context.Context) {
a.logger.Debug("Calling app startup method")
a.ctx = ctx
}
func (a *App) domReady(ctx context.Context) {
a.logger.Debug("Calling app domReady method")
a.ctx = ctx
}
func (a *App) shutdown(ctx context.Context) {
a.logger.Debug("Calling app shutdown method")
backend.CloseLogFile()
}