< Previous | Next > | |
Product: Cluster Server Guides | |
Manual: Cluster Server 4.1 Agent Developer's Guide |
Severity Arguments for C++ MacrosA severity argument for a logging macro, for example, VCS_ERROR or VCS_DBG1, is in fact a macro itself that expands to include the following information:
For example, the application severity argument VCS_ERROR within the monitor entry point for the FileOnOff agent would expand to include the following information: ERROR, file_monitor, FileOnOff.C, 28 Application severity macros map to application severities defined by the enum VCSAgAppSev and the debug severity macros map to severities defined by the enum VCSAgDbgSev. For example, in the VCSAgApiDefs.h function, these enumerated types are defined as: enum VCSAgAppSev { AG_CRITICAL, AG_ERROR, AG_WARNING, AG_NOTICE, AG_INFORMATION }; enum VCSAgDbgSev { DBG1, DBG2, DBG3, . . DBG21, AG_DBG_SEV_End }; With the severity macros, agent developers need not specify the name of the function, the file name, and the line number in each log call. The name of the function, however, must be initialized by using the macro VCSAG_LOG_INIT. See Initializing function_name Using VCSAG_LOG_INIT. Initializing function_name Using VCSAG_LOG_INITOne requirement for logging of messages included in C++ functions is to initialize the function_name variable within each function. The macro, VCSAG_LOG_INIT, defines a local constant character string to store the function name: VCSAG_LOG_INIT(func_name) const char *_function_name_ = func_name For example, the function named "file_offline" would contain: void file_offline (int, a, char *b) { VCSAG_LOG_INIT("file_offline"); . . } Note If the function name is not initialized with the VCSAG_LOG_INIT macro, when the agent is compiled, errors indicate that the name of the function is not defined. See the Examples of Logging APIs Used in a C++ Agent for more examples of the VCSAG_LOG_INIT macro. |
^ Return to Top | < Previous | Next > |
Product: Cluster Server Guides | |
Manual: Cluster Server 4.1 Agent Developer's Guide | |
VERITAS Software Corporation
www.veritas.com |