48 lines
1018 B
Go
48 lines
1018 B
Go
// Generated by `wit-bindgen` 0.57.1. DO NOT EDIT!
|
|
//
|
|
// This code was generated from the following packages:
|
|
// pumpkin:plugin@0.1.0
|
|
|
|
package pumpkin_plugin_logging
|
|
|
|
import (
|
|
"runtime"
|
|
"unsafe"
|
|
)
|
|
|
|
const (
|
|
LevelTrace uint8 = 0
|
|
LevelDebug uint8 = 1
|
|
LevelInfo uint8 = 2
|
|
LevelWarn uint8 = 3
|
|
LevelError uint8 = 4
|
|
)
|
|
|
|
type Level = uint8
|
|
|
|
//go:wasmimport pumpkin:plugin/logging@0.1.0 log
|
|
func wasm_import_log(arg0 int32, arg1 uintptr, arg2 uint32)
|
|
|
|
func Log(level Level, message string) {
|
|
pinner := &runtime.Pinner{}
|
|
defer pinner.Unpin()
|
|
|
|
utf8 := unsafe.Pointer(unsafe.StringData(message))
|
|
pinner.Pin(utf8)
|
|
wasm_import_log(int32(level), uintptr(utf8), uint32(len(message)))
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/logging@0.1.0 log-tracing
|
|
func wasm_import_log_tracing(arg0 uintptr, arg1 uint32)
|
|
|
|
func LogTracing(event []uint8) {
|
|
pinner := &runtime.Pinner{}
|
|
defer pinner.Unpin()
|
|
|
|
data := unsafe.Pointer(unsafe.SliceData(event))
|
|
pinner.Pin(data)
|
|
wasm_import_log_tracing(uintptr(data), uint32(len(event)))
|
|
|
|
}
|