ham_action_log
![]() |
![]() |
![]() |
![]() |
ham_action_log()
Insert a log message into the activity log of the HAM
Synopsis:
#include <ha/ham.h>
ham_action_t *ham_action_log(
ham_condition_t *chdl,
const char *aname,
const char *msg,
unsigned attachprefix,
int verbosity,
unsigned flags);
Library:
libham
Description:
You can use the ham_action_log() function to insert log messages into the activity log stream that the HAM maintains.
The handle (chdl) is obtained either:
- from one of the ham_condition*() functions to
add conditions
or:
- by calling any of the ham_condition_handle() functions to request a handle to a specific condition.
The log message to be inserted is specified by msg, and will be generated if the verbosity of the HAM is greater than or equal to the value specified in verbosity. Also, if attachprefix is non-zero, a prefix will be added to the log message that contains the current entity/condition/action that this message is related to.
The following flag is currently defined:
- HREARMAFTERRESTART
- Indicates that the action is to be automatically rearmed after the entity that it belongs to is restarted. By default, this flag is disabled -- actions automatically get pruned across restarts of the entity. Note that if the condition that this action belongs to is pruned after a restart, this action will also be removed, regardless of the value of this flag.
Returns:
A valid handle to an action to a condition, or NULL if an error occurred (errno is set).
Errors:
- EBADF
- Couldn't connect to the HAM.
- EINVAL
- The name given in aname is invalid (e.g. it
contains the "/" character) or is NULL.
The connection to the HAM is invalid. This happens when the process that opened the connection (using ham_connect()) and the process that's calling ham_action_restart() aren't the same.
- ENAMETOOLONG
- The name given (in aname) is too long, i.e. it exceeds _POSIX_PATH_MAX (defined in <limits.h>). Note that the combined length of an entity/condition/action name is also limited by _POSIX_PATH_MAX.
- ENOENT
- There's no entity or condition specified by the given handle (chdl).
- ENOMEM
- Not enough memory to create a new handle.
In addition to the above errors, the HAM returns any error it encounters while servicing this request.
Classification:
| Safety: | |
|---|---|
| Cancellation point | No |
| Interrupt handler | No |
| Signal handler | No |
| Thread | Yes |
![]() |
![]() |
![]() |
![]() |
![[Previous]](../prev.gif)
![[Contents]](../contents.gif)
![[Index]](../keyword_index.gif)
![[Next]](../next.gif)