Interface LogWriterFunc
- All Superinterfaces:
FunctionPointer
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
LogWriterFunc callback.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionrun(Set<LogLevelFlags> logLevel, @Nullable LogField @Nullable [] fields) Writer function for log entries.default MemorySegmenttoCallback(Arena arena) Creates a native function pointer to theupcall(int, java.lang.foreign.MemorySegment, long, java.lang.foreign.MemorySegment)method.default intupcall(int logLevel, MemorySegment fields, long nFields, MemorySegment userData) Theupcallmethod is called from native code.
-
Method Details
-
run
Writer function for log entries. A log entry is a collection of one or moreGLogFields, using the standard field names from journal specification. See g_log_structured() for more information.Writer functions must ignore fields which they do not recognise, unless they can write arbitrary binary output, as field values may be arbitrary binary.
logLevelis guaranteed to be included infieldsas thePRIORITYfield, but is provided separately for convenience of deciding whether or where to output the log entry.Writer functions should return
LogWriterOutput.HANDLEDif they handled the log message successfully or if they deliberately ignored it. If there was an error handling the message (for example, if the writer function is meant to send messages to a remote logging server and there is a network error), it should returnLogWriterOutput.UNHANDLED. This allows writer functions to be chained and fall back to simpler handlers in case of failure.- Since:
- 2.50
-
upcall
Theupcallmethod is called from native code. The parameters are marshaled andrun(java.util.Set<org.gnome.glib.LogLevelFlags>, org.gnome.glib.LogField[])is executed. -
toCallback
Creates a native function pointer to theupcall(int, java.lang.foreign.MemorySegment, long, java.lang.foreign.MemorySegment)method.- Specified by:
toCallbackin interfaceFunctionPointer- Parameters:
arena- the arena in which the function pointer is allocated- Returns:
- the native function pointer
-