Expose API to set log level in embedder (#2907)

Expose API `void wasm_runtime_set_log_level(log_level_t level)`.
This commit is contained in:
Enrico Loparco 2023-12-15 11:49:33 +01:00 committed by GitHub
parent b5022015fc
commit 6dbfeb25dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View File

@ -701,6 +701,12 @@ wasm_runtime_full_init(RuntimeInitArgs *init_args)
return true;
}
void
wasm_runtime_set_log_level(log_level_t level)
{
bh_log_set_verbose_level(level);
}
bool
wasm_runtime_is_running_mode_supported(RunningMode running_mode)
{

View File

@ -212,6 +212,14 @@ typedef struct wasm_val_t {
} wasm_val_t;
#endif
typedef enum {
WASM_LOG_LEVEL_FATAL = 0,
WASM_LOG_LEVEL_ERROR = 1,
WASM_LOG_LEVEL_WARNING = 2,
WASM_LOG_LEVEL_DEBUG = 3,
WASM_LOG_LEVEL_VERBOSE = 4
} log_level_t;
/**
* Initialize the WASM runtime environment, and also initialize
* the memory allocator with system allocator, which calls os_malloc
@ -234,6 +242,14 @@ wasm_runtime_init(void);
WASM_RUNTIME_API_EXTERN bool
wasm_runtime_full_init(RuntimeInitArgs *init_args);
/**
* Set the log level. To be called after the runtime is initialized.
*
* @param level the log level to set
*/
WASM_RUNTIME_API_EXTERN void
wasm_runtime_set_log_level(log_level_t level);
/**
* Query whether a certain running mode is supported for the runtime
*