MCPcopy Index your code
hub / github.com/php/frankenphp / go_log_attrs

Function go_log_attrs

frankenphp.go:720–742  ·  view source on GitHub ↗

export go_log_attrs

(threadIndex C.uintptr_t, message *C.zend_string, cLevel C.zend_long, cAttrs *C.zval)

Source from the content-addressed store, hash-verified

718
719//export go_log_attrs
720func go_log_attrs(threadIndex C.uintptr_t, message *C.zend_string, cLevel C.zend_long, cAttrs *C.zval) *C.char {
721 logger, ctx := getLogger(threadIndex)
722
723 level := slog.Level(cLevel)
724
725 if !logger.Enabled(ctx, level) {
726 return nil
727 }
728
729 var attrs map[string]any
730
731 if cAttrs != nil {
732 var err error
733 if attrs, err = GoMap[any](unsafe.Pointer(*(**C.zend_array)(unsafe.Pointer(&cAttrs.value[0])))); err != nil {
734 // PHP exception message.
735 return C.CString("Failed to log message: converting attrs: " + err.Error())
736 }
737 }
738
739 logger.LogAttrs(ctx, level, GoString(unsafe.Pointer(message)), mapToAttr(attrs)...)
740
741 return nil
742}
743
744func mapToAttr(input map[string]any) []slog.Attr {
745 out := make([]slog.Attr, 0, len(input))

Callers

nothing calls this directly

Calls 4

getLoggerFunction · 0.85
GoStringFunction · 0.85
mapToAttrFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected