log: add log.use_stdout(), use it to silence the transition note for the most commonly used V tools/examples (#23642)

This commit is contained in:
Delyan Angelov 2025-02-03 12:37:57 +02:00 committed by GitHub
parent 23c3af8b4d
commit 319eb83525
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 24 additions and 7 deletions

View file

@ -41,6 +41,7 @@ fn lexec(cmd string) string {
fn main() {
// ensure all log messages will be visible to the observers, even if the program panics
log.use_stdout()
log.set_always_flush(true)
total_sw := time.new_stopwatch()

View file

@ -97,6 +97,7 @@ struct FlagOptions {
}
fn main() {
log.use_stdout()
mut fp := flag.new_flag_parser(os.args.clone())
fp.application(app_name)
fp.version(app_version)

View file

@ -148,6 +148,7 @@ fn normalize_path(path string) string {
}
fn main() {
log.use_stdout()
mut ctx := Context{}
ctx.working_folder = normalize_path(os.real_path(os.getwd()))
mut fp := flag.new_flag_parser(os.args#[1..])

View file

@ -23,9 +23,7 @@ mut:
const vexe = os.real_path(os.getenv_opt('VEXE') or { @VEXE })
fn main() {
mut l := log.ThreadSafeLog{}
l.set_output_stream(os.stdout())
log.set_logger(l)
log.use_stdout()
mut ctx := Context{}
mut fp := flag.new_flag_parser(os.args#[1..])
fp.application(os.file_name(os.executable()))

View file

@ -22,6 +22,7 @@ fn run(cmd string) os.Result {
}
fn test_retry() {
log.use_stdout()
log.warn('start...')
defer {
log.warn('... done')

View file

@ -4,6 +4,7 @@ import log
const should_clean = os.args.contains('-c')
fn main() {
log.use_stdout()
mut files := []string{}
args := os.args#[2..].filter(it != '-c')
for a in args {