mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
log: improve the most common use case (#19242)
This commit is contained in:
parent
55575fd7bd
commit
6fb4a481f8
16 changed files with 576 additions and 150 deletions
|
@ -1,6 +1,14 @@
|
|||
import log
|
||||
|
||||
fn main() {
|
||||
// Note: you *do not* need to create a logger instance, and pass it around, just to use the `log` module.
|
||||
// The log module already creates an instance of a thread safe Logger, and utility functions to work with it:
|
||||
log.set_level(.debug)
|
||||
log.debug('simple debug message')
|
||||
log.warn('simple warning message')
|
||||
log.info('simple information message')
|
||||
log.error('simple error message')
|
||||
|
||||
mut l := log.Log{}
|
||||
l.set_level(.info)
|
||||
// Make a new file called info.log in the current folder
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue