Skip to content

log: add local time / utc time selection support - #24268

Merged
medvednikov merged 2 commits into
vlang:masterfrom
kbkpbot:time-add-local-time
Apr 20, 2025
Merged

medvednikov merged 2 commits into
vlang:masterfrom
kbkpbot:time-add-local-time

Conversation

@kbkpbot

@kbkpbot kbkpbot commented Apr 19, 2025 •

Copy link
Copy Markdown
Contributor

This PR enable log to set log time in local time or utc time(default).

ll.v

module main

import log

fn main() {
        mut l := log.Log{}

        l.set_time_format(.tf_default)
        l.info('utc time')

        l.set_local_time(true)
        l.info('local time')
}

run :

$ ./ll
2025-04-19 06:47 [INFO ] utc time
2025-04-19 14:47 [INFO ] local time

@huly-for-github

Copy link
Copy Markdown

Connected to Huly®: V_0.6-22646

@kbkpbot kbkpbot changed the title time: add local time / utc time selection support log: add local time / utc time selection support Apr 19, 2025
Comment thread vlib/log/log.v
return l.short_tag
}

// set_local_time will set the log using local time

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getters and setters is not really the V way... but I see the entire module is designed this way. Will have to be fixed.

@medvednikov

Copy link
Copy Markdown
Member

Useful feature, thanks.

@medvednikov
medvednikov merged commit 13645e2 into vlang:master Apr 20, 2025
@kbkpbot
kbkpbot deleted the time-add-local-time branch April 20, 2025 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants