feat: Added -verbose and -quiet flags to set the log level.

This commit is contained in:
Spencer Brower
2026-08-03 16:38:16 -04:00
parent ed842e4bea
commit f3ea6ab2a9
3 changed files with 15 additions and 2 deletions
+1 -1
View File
@@ -45,7 +45,7 @@
- [ ] talk about the context stack (and its limit). - [ ] talk about the context stack (and its limit).
- [ ] highlight the differences in the way menus are handled. - [ ] highlight the differences in the way menus are handled.
- [ ] consider sites with date based urls. - [ ] consider sites with date based urls.
- [ ] Don't show annoying log output in tests. - [x] Don't show annoying log output in tests.
- [ ] improve home link customization. - [ ] improve home link customization.
- [ ] currently an accessibility issue. - [ ] currently an accessibility issue.
- [x] support JSON5 in in frontmatter - [x] support JSON5 in in frontmatter
+12 -1
View File
@@ -46,7 +46,18 @@ main :: proc() {
logger_opts: log.Options = logger_opts: log.Options =
(log.Default_Console_Logger_Opts - log.Full_Timestamp_Opts - {.Short_File_Path}) (log.Default_Console_Logger_Opts - log.Full_Timestamp_Opts - {.Short_File_Path})
console_logger := log.create_console_logger(.Info, logger_opts) level := log.Level.Info
for arg in os.args {
switch (arg) {
case "-verbose":
level = .Debug;
break
case "-quiet":
level = .Warning;
break
}
}
console_logger := log.create_console_logger(level, logger_opts)
context.logger = console_logger context.logger = console_logger
defer log.destroy_console_logger(console_logger) defer log.destroy_console_logger(console_logger)
+2
View File
@@ -88,6 +88,8 @@ Flags :: struct {
drafts: bool `args:"name=drafts" usage:"Include draft pages in the build"`, drafts: bool `args:"name=drafts" usage:"Include draft pages in the build"`,
watch: bool `usage:"Rebuild on file changes (polls every 5 seconds)"`, watch: bool `usage:"Rebuild on file changes (polls every 5 seconds)"`,
minify: bool `args:"name=minify" usage:"Minify HTML output and CSS assets"`, minify: bool `args:"name=minify" usage:"Minify HTML output and CSS assets"`,
verbose: bool `usage:"Enable debug logging"`,
quiet: bool `usage:"Suppress info logging (warnings and errors only)"`,
md_enable: string `args:"name=ext" usage:"Enable markdown extensions (comma-separated: emoji,sidenotes,alerts,highlight,sections)"`, md_enable: string `args:"name=ext" usage:"Enable markdown extensions (comma-separated: emoji,sidenotes,alerts,highlight,sections)"`,
md_disable: string `args:"name=no-ext" usage:"Disable markdown extensions (comma-separated: emoji,sidenotes,alerts,highlight,sections)"`, md_disable: string `args:"name=no-ext" usage:"Disable markdown extensions (comma-separated: emoji,sidenotes,alerts,highlight,sections)"`,
} }