Write a warning message to the server error log.
#include "slapi-plugin.h" int slapi_log_warning_ex(long warningId, long msgId, int connId, int opId, char const * subsystem, char const * humanReadableMsg, char const * fmt, /* args */ ...);
This function takes the following parameters:
Unique identifier you provide for this warning message
Identifier for the current message obtained using SLAPI_OPERATION_MSGID
Identifier for the current connection obtained using SLAPI_CONN_ID
Identifier for the current operation obtained using SLAPI_OPERATION_ID
String indicating the context in which the warning arose such as the name of the plug-in function logging the message
String message identifying this warning
Format specification in the style of printf()
Arguments for the format specification in fmt
This function writes the specified error message to the server error log in synchronous fashion. This function does not return until the log message has been flushed to disk, thus blocking the server for the duration of the write operation. By default, the error log is $INSTANCE_PATH/logs/errors.
Unlike slapi_log_info_ex(), this function cannot be turned off.
Warning messages typically concern potentially serious situations, but not fatal errors. For fatal errors, use slapi_log_error_ex(). For informational log messages, use slapi_log_info_ex().
Example 16–4 shows a call to slapi_log_warning_ex().
#include "slapi-plugin.h" #include "example-com-warning-ids.h" /* example.com unique warning IDs file */ int foobar() { int disk_use_percentage; /* ... */ if (disk_use_percentage >= 95){ slapi_log_warning_ex( EXCOM_DISK_FULL_WARN, /* unique warning ID */ SLAPI_LOG_NO_MSGID, SLAPI_LOG_NO_CONNID, SLAPI_LOG_NO_OPID, "example.com: foobar in baz plug-in", "disk %.0f%% full, find more space\n", (float)disk_use_percentage ); } return 0; } |
This function returns 0 if successful. Otherwise, it returns -1.