mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
all: update attributes to use new syntax
This commit is contained in:
parent
dd81cb98c6
commit
757929392e
739 changed files with 2982 additions and 2982 deletions
|
@ -1,13 +1,13 @@
|
|||
// Copyright (c) 2019-2023 Alexander Medvednikov. All rights reserved.
|
||||
// Use of this source code is governed by an MIT license
|
||||
// that can be found in the LICENSE file.
|
||||
[has_globals]
|
||||
@[has_globals]
|
||||
module log
|
||||
|
||||
__global default_logger &Logger
|
||||
|
||||
// TODO: remove this hack, when the language has a way to access the raw pointer to an interface value directly:
|
||||
[typedef]
|
||||
@[typedef]
|
||||
pub struct C.log__Logger {
|
||||
mut:
|
||||
_object voidptr
|
||||
|
@ -24,7 +24,7 @@ fn deinit() {
|
|||
free_logger(default_logger)
|
||||
}
|
||||
|
||||
[manualfree]
|
||||
@[manualfree]
|
||||
fn free_logger(logger &Logger) {
|
||||
if voidptr(logger) == unsafe { nil } {
|
||||
return
|
||||
|
|
|
@ -5,7 +5,7 @@ module log
|
|||
|
||||
// set_logger changes the default logger instance to the one provided by the user.
|
||||
// The existing logger will be freed, *after* the change is done.
|
||||
[manualfree]
|
||||
@[manualfree]
|
||||
pub fn set_logger(logger &Logger) {
|
||||
// C.printf(c"set_logger logger: %p | old logger: %p\n", logger, default_logger)
|
||||
old_logger := unsafe { default_logger }
|
||||
|
@ -14,7 +14,7 @@ pub fn set_logger(logger &Logger) {
|
|||
}
|
||||
|
||||
// get_logger returns a pointer to the current default logger instance
|
||||
[unsafe]
|
||||
@[unsafe]
|
||||
pub fn get_logger() &Logger {
|
||||
return default_logger
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ pub fn (mut l Log) set_level(level Level) {
|
|||
}
|
||||
|
||||
// set_output_level sets the internal logging output to `level`.
|
||||
[deprecated: 'use .set_level(level) instead']
|
||||
[deprecated_after: '2023-09-30']
|
||||
@[deprecated: 'use .set_level(level) instead']
|
||||
@[deprecated_after: '2023-09-30']
|
||||
pub fn (mut l Log) set_output_level(level Level) {
|
||||
l.level = level
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ pub fn (mut l Log) send_output(s &string, level Level) {
|
|||
|
||||
// fatal logs line `s` via `send_output` if `Log.level` is greater than or equal to the `Level.fatal` category.
|
||||
// Note that this method performs a panic at the end, even if log level is not enabled.
|
||||
[noreturn]
|
||||
@[noreturn]
|
||||
pub fn (mut l Log) fatal(s string) {
|
||||
if int(l.level) >= int(Level.fatal) {
|
||||
l.send_output(s, .fatal)
|
||||
|
@ -161,7 +161,7 @@ pub fn (mut l Log) debug(s string) {
|
|||
}
|
||||
|
||||
// free frees the given Log instance
|
||||
[unsafe]
|
||||
@[unsafe]
|
||||
pub fn (mut f Log) free() {
|
||||
unsafe {
|
||||
f.output_label.free()
|
||||
|
|
|
@ -21,7 +21,7 @@ pub fn new_thread_safe_log() &ThreadSafeLog {
|
|||
}
|
||||
|
||||
// free frees the given ThreadSafeLog instance.
|
||||
[unsafe]
|
||||
@[unsafe]
|
||||
pub fn (mut x ThreadSafeLog) free() {
|
||||
unsafe {
|
||||
x.Log.free()
|
||||
|
@ -66,7 +66,7 @@ pub fn (mut x ThreadSafeLog) error(s string) {
|
|||
}
|
||||
|
||||
// fatal logs a fatal message, and panics
|
||||
[noreturn]
|
||||
@[noreturn]
|
||||
pub fn (mut x ThreadSafeLog) fatal(s string) {
|
||||
x.mu.@lock()
|
||||
defer {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue