Skip to content

Commit 9207126

Browse files
committed
[log] Add logs during initialization
1 parent 2f0c626 commit 9207126

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

docker.log

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
time=2025-09-03T14:30:42.435Z level=DEBUG msg="incorporated json file" filename=config.json config="&{Config:{TemplatesDir:templates TemplatesFS:<nil> TemplateExtension: Minify:false Databases:[{DB:<nil> TxOptions:<nil> Name:DB Driver:sqlite3 Connstr:file:./test.sqlite MaxOpenConns:0}] Flags:[{Name:Flags Values:map[a:1 b:2 hello:world]}] Directories:[{Name:FS Path:data Type: FS:<nil>} {Name:FSW Path:. Type: FS:<nil>}] Nats:[{Name:Nats NatsConfig:0xc0003ac120 Conn:<nil> server:<nil> js:<nil>}] CustomProviders:[] LDelim: RDelim: FuncMaps:[] Ctx:<nil> Logger:<nil>} Watch:[] WatchTemplates:false Listen:0.0.0.0:80 LogLevel:0 Configs:[] ConfigFiles:[]}"
2+
time=2025-09-03T14:30:42.435Z level=DEBUG msg="loaded configuration" config="&{Config:{TemplatesDir:templates TemplatesFS:<nil> TemplateExtension:.html Minify:true Databases:[{DB:<nil> TxOptions:<nil> Name:DB Driver:sqlite3 Connstr:file:./test.sqlite MaxOpenConns:0}] Flags:[{Name:Flags Values:map[a:1 b:2 hello:world]}] Directories:[{Name:FS Path:data Type: FS:<nil>} {Name:FSW Path:. Type: FS:<nil>}] Nats:[{Name:Nats NatsConfig:0xc0003ac120 Conn:<nil> server:<nil> js:<nil>}] CustomProviders:[] LDelim:{{ RDelim:}} FuncMaps:[] Ctx:<nil> Logger:0xc00003a0b0} Watch:[] WatchTemplates:false Listen:0.0.0.0:80 LogLevel:-4 Configs:[] ConfigFiles:[config.json]}"
3+
time=2025-09-03T14:30:42.435Z level=INFO msg=initializing xtemplate.instance=1
4+
time=2025-09-03T14:30:42.436Z level=DEBUG msg="added static file handler" xtemplate.instance=1 xtemplate.path=/assets/empty.txt xtemplate.filepath=assets/empty.txt xtemplate.contenttype="text/plain; charset=utf-8" xtemplate.size=0 xtemplate.modtime=2025-09-03T14:28:22.173Z xtemplate.hash=sha384-OLBgp1GsljhM2TJ-sbHjaiH9txEUvgdDTAzHv2P24donTt6_529l-9Ua0vFImLlb
5+
time=2025-09-03T14:30:42.438Z level=DEBUG msg="added static file handler" xtemplate.instance=1 xtemplate.path=/assets/file.txt xtemplate.filepath=assets/file.txt xtemplate.contenttype="text/plain; charset=utf-8" xtemplate.size=7 xtemplate.modtime=2025-09-03T14:28:22.173Z xtemplate.hash=sha384-z0gR10_UBQRnT8MnP4JPpC91W5ZgoukCtX8d90hz2xqRoDe87mXxqI7NHvV_8lTJ
6+
time=2025-09-03T14:30:42.438Z level=DEBUG msg="added static file encoding" xtemplate.instance=1 xtemplate.path=/assets/file.txt xtemplate.filepath=assets/file.txt.gz xtemplate.encoding=gzip xtemplate.size=36 xtemplate.modtime=2025-09-03T14:28:22.173Z
7+
time=2025-09-03T14:30:42.439Z level=DEBUG msg="added template handler" xtemplate.instance=1 xtemplate.method=GET xtemplate.pattern="GET /assets/link" xtemplate.template_path=/assets/link.html
8+
time=2025-09-03T14:30:42.439Z level=DEBUG msg="added static file handler" xtemplate.instance=1 xtemplate.path=/assets/print.css xtemplate.filepath=assets/print.css xtemplate.contenttype="text/css; charset=utf-8" xtemplate.size=16 xtemplate.modtime=2025-09-03T14:28:22.173Z xtemplate.hash=sha384-VBwZsM3wMf6SeaePnV2LhbL8ryBAehpKhRjGRmZEVjgf6mTm1gwPEIyzhinMkDjM
9+
time=2025-09-03T14:30:42.439Z level=DEBUG msg="added static file handler" xtemplate.instance=1 xtemplate.path=/assets/reset.css xtemplate.filepath=assets/reset.css xtemplate.contenttype="text/css; charset=utf-8" xtemplate.size=2769 xtemplate.modtime=2025-09-03T14:28:22.173Z xtemplate.hash=sha384-5rcfZgbOPW7qvI7_bo9eNa8hclwmmmzNeyvDzZlqI6vAzNwzbmi7PTS4uA15-fJj
10+
time=2025-09-03T14:30:42.439Z level=DEBUG msg="added static file encoding" xtemplate.instance=1 xtemplate.path=/assets/reset.css xtemplate.filepath=assets/reset.css.br xtemplate.encoding=br xtemplate.size=928 xtemplate.modtime=2025-09-03T14:28:22.173Z
11+
time=2025-09-03T14:30:42.439Z level=DEBUG msg="added static file encoding" xtemplate.instance=1 xtemplate.path=/assets/reset.css xtemplate.filepath=assets/reset.css.gz xtemplate.encoding=gzip xtemplate.size=1161 xtemplate.modtime=2025-09-03T14:28:22.173Z
12+
time=2025-09-03T14:30:42.439Z level=DEBUG msg="added static file handler" xtemplate.instance=1 xtemplate.path=/assets/standalone.gz xtemplate.filepath=assets/standalone.gz xtemplate.contenttype=application/x-gzip xtemplate.size=57 xtemplate.modtime=2025-09-03T14:28:22.173Z xtemplate.hash=sha384-0cNE6KPd2MUuaSX1QoMEVPJyaeLrbZhclsWJTBWgN3hb0Kdaeg2OT1HPvFKbANTh
13+
time=2025-09-03T14:30:42.439Z level=DEBUG msg="added template handler" xtemplate.instance=1 xtemplate.method=GET xtemplate.pattern="GET /db" xtemplate.template_path=/db/index.html
14+
time=2025-09-03T14:30:42.440Z level=DEBUG msg="added static file handler" xtemplate.instance=1 xtemplate.path=/favicon.ico xtemplate.filepath=favicon.ico xtemplate.contenttype=image/x-icon xtemplate.size=318 xtemplate.modtime=2025-09-03T14:28:22.173Z xtemplate.hash=sha384-8685vN3d0Al9eiCvAn5kWaDDCkkGSxR0BNyWwLOAGMGpbVjTJ8IM29IljdDi6GS1
15+
time=2025-09-03T14:30:42.440Z level=DEBUG msg="added template handler" xtemplate.instance=1 xtemplate.method=GET xtemplate.pattern="GET /flags" xtemplate.template_path=/flags/index.html
16+
time=2025-09-03T14:30:42.440Z level=DEBUG msg="added template handler" xtemplate.instance=1 xtemplate.method=GET xtemplate.pattern="GET /fs/browse/{filepath...}" xtemplate.template_path=/fs/browse/{filepath...}.html
17+
time=2025-09-03T14:30:42.440Z level=DEBUG msg="added template handler" xtemplate.instance=1 xtemplate.method=GET xtemplate.pattern="GET /fs/openclose" xtemplate.template_path=/fs/openclose.html
18+
time=2025-09-03T14:30:42.440Z level=DEBUG msg="added template handler" xtemplate.instance=1 xtemplate.method=GET xtemplate.pattern="GET /fs/serve" xtemplate.template_path=/fs/serve.html
19+
time=2025-09-03T14:30:42.440Z level=DEBUG msg="added template handler" xtemplate.instance=1 xtemplate.method=GET xtemplate.pattern="GET /hello" xtemplate.template_path=/hello.html
20+
time=2025-09-03T14:30:42.441Z level=DEBUG msg="added template handler" xtemplate.instance=1 xtemplate.method=GET xtemplate.pattern="GET /{$}" xtemplate.template_path=/index{$}.html
21+
time=2025-09-03T14:30:42.441Z level=DEBUG msg="added template handler" xtemplate.instance=1 xtemplate.method=GET xtemplate.pattern="GET /nats/messages" xtemplate.template_path=/nats/index.html
22+
time=2025-09-03T14:30:42.441Z level=DEBUG msg="added template handler" xtemplate.instance=1 xtemplate.method=GET xtemplate.pattern="POST /nats/messages" xtemplate.template_path=/nats/index.html
23+
time=2025-09-03T14:30:42.441Z level=DEBUG msg="added template handler" xtemplate.instance=1 xtemplate.method=GET xtemplate.pattern="GET /nats" xtemplate.template_path=/nats/index.html
24+
time=2025-09-03T14:30:42.441Z level=DEBUG msg="added template handler" xtemplate.instance=1 xtemplate.method=GET xtemplate.pattern="GET /ready" xtemplate.template_path=/ready.html
25+
time=2025-09-03T14:30:42.441Z level=DEBUG msg="added template handler" xtemplate.instance=1 xtemplate.method=GET xtemplate.pattern="GET /routing/file" xtemplate.template_path=/routing/file.html
26+
time=2025-09-03T14:30:42.442Z level=DEBUG msg="added template handler" xtemplate.instance=1 xtemplate.method=GET xtemplate.pattern="GET /routing" xtemplate.template_path=/routing/index.html
27+
time=2025-09-03T14:30:42.442Z level=DEBUG msg="added template handler" xtemplate.instance=1 xtemplate.method=GET xtemplate.pattern="GET /routing/visible" xtemplate.template_path=/routing/visible.html
28+
time=2025-09-03T14:30:42.442Z level=DEBUG msg="added template handler" xtemplate.instance=1 xtemplate.method=GET xtemplate.pattern="GET /reload" xtemplate.template_path=/sse/hotreload.html
29+
time=2025-09-03T14:30:42.442Z level=DEBUG msg="added template handler" xtemplate.instance=1 xtemplate.method=GET xtemplate.pattern="GET /sse/hotreload" xtemplate.template_path=/sse/hotreload.html
30+
time=2025-09-03T14:30:42.442Z level=DEBUG msg="added template handler" xtemplate.instance=1 xtemplate.method=GET xtemplate.pattern="GET /sse/test" xtemplate.template_path=/sse/test.html
31+
time=2025-09-03T14:30:42.442Z level=DEBUG msg="added template handler" xtemplate.instance=1 xtemplate.method=GET xtemplate.pattern="GET /sse/events" xtemplate.template_path=/sse/test.html
32+
time=2025-09-03T14:30:44.036Z level=INFO msg="instance loaded" xtemplate.instance=1 xtemplate.load_time=1.600857327s xtemplate.stats.routes=25 xtemplate.stats.templateFiles=16 xtemplate.stats.templateDefinitions=23 xtemplate.stats.templateInitializers=0 xtemplate.stats.staticFiles=6 xtemplate.stats.staticFilesAlternateEncodings=3
33+
time=2025-09-03T14:30:44.036Z level=INFO msg="rebuild succeeded" xtemplate.reload.new_id=1 xtemplate.reload.rebuild_time=1.601084997s
34+
time=2025-09-03T14:30:44.036Z level=INFO msg="starting server"
35+
time=2025-09-03T14:30:49.193Z level=DEBUG msg="serving request" xtemplate.instance=1 xtemplate.serve.requestid=a720cba8-2688-4bc2-a758-1b32c87fa18a xtemplate.user-agent=curl/8.5.0 xtemplate.method=GET xtemplate.requestPath=/ready
36+
time=2025-09-03T14:30:49.193Z level=DEBUG+2 msg="request served" xtemplate.instance=1 xtemplate.serve.requestid=a720cba8-2688-4bc2-a758-1b32c87fa18a xtemplate.response.duration=108.956µs xtemplate.response.statusCode=200 xtemplate.response.bytes=2

instance.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ func (config *Config) Instance(cfgs ...Option) (*Instance, *InstanceStats, []Ins
154154
}
155155
}
156156
for _, d := range dot {
157+
start := time.Now()
157158
err := d.Init(build.config.Ctx)
159+
build.config.Logger.Debug("initialized provider", "name", d.FieldName(), "type", reflect.TypeOf(d).String(), "duration", time.Since(start))
158160
if err != nil {
159161
return nil, nil, nil, fmt.Errorf("failed to initialize dot field '%s': %w", d.FieldName(), err)
160162
}

0 commit comments

Comments
 (0)