mirror of
https://github.com/sbrow/thor.git
synced 2026-08-26 11:23:32 -04:00
feat: Added -verbose and -quiet flags to set the log level.
This commit is contained in:
@@ -45,7 +45,7 @@
|
||||
- [ ] talk about the context stack (and its limit).
|
||||
- [ ] highlight the differences in the way menus are handled.
|
||||
- [ ] 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.
|
||||
- [ ] currently an accessibility issue.
|
||||
- [x] support JSON5 in in frontmatter
|
||||
|
||||
@@ -46,7 +46,18 @@ main :: proc() {
|
||||
|
||||
logger_opts: log.Options =
|
||||
(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
|
||||
defer log.destroy_console_logger(console_logger)
|
||||
|
||||
|
||||
@@ -88,6 +88,8 @@ Flags :: struct {
|
||||
drafts: bool `args:"name=drafts" usage:"Include draft pages in the build"`,
|
||||
watch: bool `usage:"Rebuild on file changes (polls every 5 seconds)"`,
|
||||
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_disable: string `args:"name=no-ext" usage:"Disable markdown extensions (comma-separated: emoji,sidenotes,alerts,highlight,sections)"`,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user