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, LogField[] fields) Writer function for log entries.default MemorySegment
toCallback
(Arena arena) Creates a native function pointer to theupcall(int, java.lang.foreign.MemorySegment, long, java.lang.foreign.MemorySegment)
method.default int
upcall
(int logLevel, MemorySegment fields, long nFields, MemorySegment userData) Theupcall
method 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](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html). 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.
logLevel
is guaranteed to be included infields
as thePRIORITY
field, but is provided separately for convenience of deciding whether or where to output the log entry.Writer functions should return
LogWriterOutput.HANDLED
if 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. -
upcall
Theupcall
method 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:
toCallback
in interfaceFunctionPointer
- Parameters:
arena
- the function pointer will be allocated in this arena- Returns:
- the native function pointer
-