API reference
GD.log
Entry for ordered I/O of one line at a time with a consistent level, time, and destination. flush waits for earlier output.
Methods
setup(name: String = "", level: String = "info") -> voidset_file(path: String) -> voidset_time(on: bool) -> voidset_color(on: bool) -> voidwrite(level: String, msg: String, extra: Variant = null) -> Variant, Errdebug(msg: String, extra: Variant = null) -> Variant, Errinfo(msg: String, extra: Variant = null) -> Variant, Errwarn(msg: String, extra: Variant = null) -> Variant, Errerror(msg: String, extra: Variant = null) -> Variant, Errresult(error: Err, msg: String) -> Variant, Errwrite_async(level: String, msg: String, extra: Variant = null) -> await Variant, Errdebug_async(msg: String, extra: Variant = null) -> await Variant, Errinfo_async(msg: String, extra: Variant = null) -> await Variant, Errwarn_async(msg: String, extra: Variant = null) -> await Variant, Errerror_async(msg: String, extra: Variant = null) -> await Variant, Errresult_async(error: Err, msg: String) -> await Variant, Errformat(level: String, msg: String, extra: Variant = null) -> Stringflush() -> Variant, Errflush_async() -> await Variant, Err
setup
setup(name: String = "", level: String = "info") -> voidSet the logger name and minimum level.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
name | String | "" | Name used to register or look up the corresponding entry. |
level | String | "info" | Minimum or selected log severity name. |
Return value
void
No value is returned.
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
set_file
set_file(path: String) -> voidSet the file receiving appended log lines.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
path | String | Required | Filesystem path; relative paths use the execution directory and access follows configured permissions. |
Return value
void
No value is returned.
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
set_time
set_time(on: bool) -> voidConfigure whether log lines include a timestamp.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
on | bool | Required | True enables the setting; false disables it. |
Return value
void
No value is returned.
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
set_color
set_color(on: bool) -> voidConfigure terminal color output.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
on | bool | Required | True enables the setting; false disables it. |
Return value
void
No value is returned.
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
write
write(level: String, msg: String, extra: Variant = null) -> Variant, ErrWrite a line at a level selected by name.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
level | String | Required | Minimum or selected log severity name. |
msg | String | Required | Message text associated with this operation. |
extra | Variant | null | Additional structured values to include with the log message. |
Return value
Variant, Err
Suspends only the calling routine until the operation completes. No explicit await is needed.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
debug
debug(msg: String, extra: Variant = null) -> Variant, ErrWrite a debug-level line.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
msg | String | Required | Message text associated with this operation. |
extra | Variant | null | Additional structured values to include with the log message. |
Return value
Variant, Err
Suspends only the calling routine until the operation completes. No explicit await is needed.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
info
info(msg: String, extra: Variant = null) -> Variant, ErrWrite an info-level line.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
msg | String | Required | Message text associated with this operation. |
extra | Variant | null | Additional structured values to include with the log message. |
Return value
Variant, Err
Suspends only the calling routine until the operation completes. No explicit await is needed.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
warn
warn(msg: String, extra: Variant = null) -> Variant, ErrWrite a warning-level line.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
msg | String | Required | Message text associated with this operation. |
extra | Variant | null | Additional structured values to include with the log message. |
Return value
Variant, Err
Suspends only the calling routine until the operation completes. No explicit await is needed.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
error
error(msg: String, extra: Variant = null) -> Variant, ErrWrite an error-level line.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
msg | String | Required | Message text associated with this operation. |
extra | Variant | null | Additional structured values to include with the log message. |
Return value
Variant, Err
Suspends only the calling routine until the operation completes. No explicit await is needed.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
result
result(error: Err, msg: String) -> Variant, ErrLog a failed operation's error.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
error | Err | Required | Error value to classify when choosing an HTTP status. |
msg | String | Required | Message text associated with this operation. |
Return value
Variant, Err
Suspends only the calling routine until the operation completes. No explicit await is needed.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
write_async
write_async(level: String, msg: String, extra: Variant = null) -> await Variant, ErrWrite a line at a level selected by name.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
level | String | Required | Minimum or selected log severity name. |
msg | String | Required | Message text associated with this operation. |
extra | Variant | null | Additional structured values to include with the log message. |
Return value
await Variant, Err
Returns a Signal. Use await to receive the completion value shown in the signature.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
debug_async
debug_async(msg: String, extra: Variant = null) -> await Variant, ErrWrite a debug-level line.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
msg | String | Required | Message text associated with this operation. |
extra | Variant | null | Additional structured values to include with the log message. |
Return value
await Variant, Err
Returns a Signal. Use await to receive the completion value shown in the signature.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
info_async
info_async(msg: String, extra: Variant = null) -> await Variant, ErrWrite an info-level line.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
msg | String | Required | Message text associated with this operation. |
extra | Variant | null | Additional structured values to include with the log message. |
Return value
await Variant, Err
Returns a Signal. Use await to receive the completion value shown in the signature.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
warn_async
warn_async(msg: String, extra: Variant = null) -> await Variant, ErrWrite a warning-level line.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
msg | String | Required | Message text associated with this operation. |
extra | Variant | null | Additional structured values to include with the log message. |
Return value
await Variant, Err
Returns a Signal. Use await to receive the completion value shown in the signature.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
error_async
error_async(msg: String, extra: Variant = null) -> await Variant, ErrWrite an error-level line.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
msg | String | Required | Message text associated with this operation. |
extra | Variant | null | Additional structured values to include with the log message. |
Return value
await Variant, Err
Returns a Signal. Use await to receive the completion value shown in the signature.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
result_async
result_async(error: Err, msg: String) -> await Variant, ErrLog a failed operation's error.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
error | Err | Required | Error value to classify when choosing an HTTP status. |
msg | String | Required | Message text associated with this operation. |
Return value
await Variant, Err
Returns a Signal. Use await to receive the completion value shown in the signature.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
format
format(level: String, msg: String, extra: Variant = null) -> StringFormat a log line without writing it.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
level | String | Required | Minimum or selected log severity name. |
msg | String | Required | Message text associated with this operation. |
extra | Variant | null | Additional structured values to include with the log message. |
Return value
String
Errors
This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.
flush
flush() -> Variant, ErrReturn a signal after preceding file output completes.
Parameters
No parameters.
Return value
Variant, Err
Suspends only the calling routine until the operation completes. No explicit await is needed.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.
flush_async
flush_async() -> await Variant, ErrReturn a signal after preceding file output completes.
Parameters
No parameters.
Return value
await Variant, Err
Returns a Signal. Use await to receive the completion value shown in the signature.
Errors
The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.