Name | |
---|---|
enum | MamaLogLevel { MAMA_LOG_LEVEL_OFF = 0, MAMA_LOG_LEVEL_SEVERE = 1, MAMA_LOG_LEVEL_ERROR = 2, MAMA_LOG_LEVEL_WARN = 3, MAMA_LOG_LEVEL_NORMAL = 4, MAMA_LOG_LEVEL_FINE = 5, MAMA_LOG_LEVEL_FINER = 6, MAMA_LOG_LEVEL_FINEST = 7} MAMA Log Level. |
enum | mamaLogFilePolicy { LOGFILE_UNBOUNDED = 1, LOGFILE_ROLL = 2, LOGFILE_OVERWRITE = 3, LOGFILE_USER = 4} MAMA Log Policy. |
typedef void(MAMACALLTYPE *)(MamaLogLevel level, const char *format, va_list ap) | mamaLogCb Definition of a callback. |
typedef void(MAMACALLTYPE *)(MamaLogLevel level, const char *message) | mamaLogCb2 Definition of a callback. |
typedef void(MAMACALLTYPE *)(const char *prefix, const char *format, va_list ap) | mamaLogCb3 Definition of a callback. |
typedef void(*)(void) | logSizeCbType Definition of a callback. |
Name | |
---|---|
MAMAExpDLL void MAMACALLTYPE | mama_logDefault(MamaLogLevel level, const char * format, va_list ap) The default logging within the API unless otherwise specified. |
MAMAExpDLL void MAMACALLTYPE | mama_logDefault2(MamaLogLevel level, const char * message) Second Log Function. |
MAMAExpDLL void | mama_logStdout(MamaLogLevel level, const char * format, … ) Log to Standard Output. |
MAMAExpDLL void MAMACALLTYPE | mama_forceLogDefault(MamaLogLevel level, const char * format, va_list ap) Forced Log Function. |
MAMAExpDLL void MAMACALLTYPE | mama_forceLogPrefixDefault(const char * prefix, const char * format, va_list ap) Forced Log Prefix Function. |
MAMAExpDLL mama_status | mama_enableLogging(FILE * file, MamaLogLevel level) Enable Logging. |
MAMAExpDLL mama_status | mama_logToFile(const char * file, MamaLogLevel level) Behaves as mama_enableLogging() but accepts a string representing the file location. |
MAMAExpDLL mama_status | mama_disableLogging(void ) Disable logging. |
MAMAExpDLL void | mama_log(MamaLogLevel level, const char * format, … ) Used for the majority of logging within the API. |
MAMAExpDLL void MAMACALLTYPE | mama_log2(MamaLogLevel level, const char * message) Second Log Function. |
MAMAExpDLL void | mama_logVa(MamaLogLevel level, const char * format, va_list args) Used for of logging within the API. |
MAMAExpDLL void | mama_forceLogVa(const char * format, va_list args) Used the force logging using variable argument parameters. |
MAMAExpDLL void | mama_forceLogVaWithPrefix(const char * prefix, const char * format, va_list args) Used to add a custom prefix to a log line with a variable arg list. |
MAMAExpDLL void | mama_forceLog(MamaLogLevel level, const char * format, … ) Used for of logging within the API. |
MAMAExpDLL void | mama_forceLogWithPrefix(const char * prefix, const char * format, … ) Used to add a custom prefix when logging a line. |
MAMAExpDLL mama_status | mama_setLogCallback(mamaLogCb callback) Set the callback to be used for mama_log calls. If not set then mama_logDefault will be used. |
MAMAExpDLL mama_status | mama_setLogCallback2(mamaLogCb2 callback) Second set callback function. |
MAMAExpDLL mama_status | mama_setForceLogCallback(mamaLogCb callback) Set the callback to be used for mama logging. If not set then mama_ForceLogDefault will be used. |
MAMAExpDLL mama_status | mama_setForceLogPrefixCallback(mamaLogCb3 callback) Set the callback to be used for mama logging. If not set then mama_ForceLogPrefixDefault will be used. |
MAMAExpDLL mama_status | mama_setLogLevel(MamaLogLevel level) Sets the log level for Mama. |
MAMAExpDLL MamaLogLevel | mama_getLogLevel(void ) Returns the current log level for Mama. |
MAMAExpDLL mama_status | mama_setLogSize(unsigned long size) Set the maxmum size of the log file (bytes). |
MAMAExpDLL mama_status | mama_setNumLogFiles(int numFiles) Set the number of rolled logfiles to keep before overwriting. |
MAMAExpDLL mama_status | mama_setLogFilePolicy(mamaLogFilePolicy policy) Set the policy regarding how to handle files when Max file size is reached. |
MAMAExpDLL mama_status | mama_setAppendToLogFile(int append) Set append to existing log file. |
MAMAExpDLL int | mama_loggingToFile(void ) Return status of loggingToFile. |
MAMAExpDLL mama_status | mama_setLogSizeCb(logSizeCbType logCallbacks) Set a callback for when the max log size is reached. |
MAMAExpDLL const char * | mama_logLevelToString(MamaLogLevel level) Return string version of log level. |
MAMAExpDLL int | mama_tryStringToLogLevel(const char * s, MamaLogLevel * level) Try to convert string to log level. |
MAMAExpDLL const char * | mama_logPolicyToString(mamaLogFilePolicy level) Return string version of log policy. |
MAMAExpDLL int | mama_tryStringToLogPolicy(const char * s, mamaLogFilePolicy * policy) Try to convert string to log policy. |
MAMAExpDLL int | mama_logIncrementVerbosity(MamaLogLevel * level) Increase by one log level the verbosity of a MamaLogLevel variable. |
MAMAExpDLL int | mama_logDecrementVerbosity(MamaLogLevel * level) Decrease by one log level the verbosity of a MamaLogLevel variable. |
MAMAExpDLL mama_status | mama_logForceRollLogFiles(void ) Force rolling the log file. |
MAMAExpDLL void | mama_logDestroy(void ) Destroy memory held by the logging. |
void | mama_loginit(void ) Setup MAMA Logging. |
Name | |
---|---|
MAMAExpDLL MamaLogLevel | gMamaLogLevel |
MAMAExpDLL FILE * | gMamaLogFile |
Enumerator | Value | Description |
---|---|---|
MAMA_LOG_LEVEL_OFF | 0 | No logging |
MAMA_LOG_LEVEL_SEVERE | 1 | Severe logging level |
MAMA_LOG_LEVEL_ERROR | 2 | Error logging level |
MAMA_LOG_LEVEL_WARN | 3 | Warning logging level |
MAMA_LOG_LEVEL_NORMAL | 4 | Normal log level |
MAMA_LOG_LEVEL_FINE | 5 | Start/Shutdown logging level |
MAMA_LOG_LEVEL_FINER | 6 | Object creation logging level |
MAMA_LOG_LEVEL_FINEST | 7 | Message logging level |
MAMA Log Level.
The level of detail when logging is enabled within the API
Enumerator | Value | Description |
---|---|---|
LOGFILE_UNBOUNDED | 1 | Default - No restrictions |
LOGFILE_ROLL | 2 | Logfile will roll |
LOGFILE_OVERWRITE | 3 | Logfile will overwrite |
LOGFILE_USER | 4 | User defined callback |
MAMA Log Policy.
The policy to control log file size
typedef void(MAMACALLTYPE * mamaLogCb) (MamaLogLevel level, const char *format, va_list ap);
Definition of a callback.
typedef void(MAMACALLTYPE * mamaLogCb2) (MamaLogLevel level, const char *message);
Definition of a callback.
typedef void(MAMACALLTYPE * mamaLogCb3) (const char *prefix, const char *format, va_list ap);
Definition of a callback.
typedef void(* logSizeCbType) (void);
Definition of a callback.
MAMAExpDLL void MAMACALLTYPE mama_logDefault(
MamaLogLevel level,
const char * format,
va_list ap
)
The default logging within the API unless otherwise specified.
Parameters:
MAMAExpDLL void MAMACALLTYPE mama_logDefault2(
MamaLogLevel level,
const char * message
)
Second Log Function.
Parameters:
This second logging function takes only a message and not a format string with a variable argument list. It is required for interoperability with all platforms that do not support C variable argument list, (e.g. .Net). Other than that it performs in exactly the same way as the first.
MAMAExpDLL void mama_logStdout(
MamaLogLevel level,
const char * format,
...
)
Log to Standard Output.
Parameters:
MAMAExpDLL void MAMACALLTYPE mama_forceLogDefault(
MamaLogLevel level,
const char * format,
va_list ap
)
Forced Log Function.
Parameters:
The default function used within the API for the mama_forceLog function pointer. If no logfile is available logging it to stderr.
MAMAExpDLL void MAMACALLTYPE mama_forceLogPrefixDefault(
const char * prefix,
const char * format,
va_list ap
)
Forced Log Prefix Function.
Parameters:
The default function used within the API for the mama_forceLogWithPrefix function pointer. If no logfile is available logging it to stderr.
MAMAExpDLL mama_status mama_enableLogging(
FILE * file,
MamaLogLevel level
)
Enable Logging.
Parameters:
Return: mama_status return code can be one of: MAMA_STATUS_PLATFORM MAMA_STATUS_OK
No per-message or per-tick messages appear at WOMBAT_LOG_LEVEL_FINE
. WOMBAT_LOG_LEVEL_FINER
and WOMBAT_LOG_LEVEL_FINEST
provide successively more detailed logging.
MAMAExpDLL mama_status mama_logToFile(
const char * file,
MamaLogLevel level
)
Behaves as mama_enableLogging() but accepts a string representing the file location.
Parameters:
Return: mama_status return code can be one of: MAMA_STATUS_INVALID_ARG MAMA_STATUS_PLATFORM MAMA_STATUS_IO_ERROR MAMA_STATUS_OK
MAMAExpDLL mama_status mama_disableLogging(
void
)
Disable logging.
Return: mama_status return code can be one of: MAMA_STATUS_INVALID_ARG MAMA_STATUS_OK
MAMAExpDLL void mama_log(
MamaLogLevel level,
const char * format,
...
)
Used for the majority of logging within the API.
Parameters:
MAMAExpDLL void MAMACALLTYPE mama_log2(
MamaLogLevel level,
const char * message
)
Second Log Function.
Parameters:
MAMAExpDLL void mama_logVa(
MamaLogLevel level,
const char * format,
va_list args
)
Used for of logging within the API.
Parameters:
MAMAExpDLL void mama_forceLogVa(
const char * format,
va_list args
)
Used the force logging using variable argument parameters.
Parameters:
MAMAExpDLL void mama_forceLogVaWithPrefix(
const char * prefix,
const char * format,
va_list args
)
Used to add a custom prefix to a log line with a variable arg list.
Parameters:
MAMAExpDLL void mama_forceLog(
MamaLogLevel level,
const char * format,
...
)
Used for of logging within the API.
Parameters:
MAMAExpDLL void mama_forceLogWithPrefix(
const char * prefix,
const char * format,
...
)
Used to add a custom prefix when logging a line.
Parameters:
MAMAExpDLL mama_status mama_setLogCallback(
mamaLogCb callback
)
Set the callback to be used for mama_log calls. If not set then mama_logDefault will be used.
Parameters:
Return: mama_status return code can be one of: MAMA_STATUS_NULL_ARG MAMA_STATUS_PLATFORM MAMA_STATUS_OK
MAMAExpDLL mama_status mama_setLogCallback2(
mamaLogCb2 callback
)
Second set callback function.
Parameters:
Return: mama_status return code can be one of: MAMA_STATUS_PLATFORM MAMA_STATUS_OK
Set the callback to be used for mama_log calls. This function will set a log callback that receives a formatted string and not a variable argument list. This function is used mainly to support managed clients.
MAMAExpDLL mama_status mama_setForceLogCallback(
mamaLogCb callback
)
Set the callback to be used for mama logging. If not set then mama_ForceLogDefault will be used.
Parameters:
Return: mama_status return code can be one of: MAMA_STATUS_NULL_ARG MAMA_STATUS_PLATFORM MAMA_STATUS_OK
MAMAExpDLL mama_status mama_setForceLogPrefixCallback(
mamaLogCb3 callback
)
Set the callback to be used for mama logging. If not set then mama_ForceLogPrefixDefault will be used.
Parameters:
Return: mama_status return code can be one of: MAMA_STATUS_NULL_ARG MAMA_STATUS_PLATFORM MAMA_STATUS_OK
MAMAExpDLL mama_status mama_setLogLevel(
MamaLogLevel level
)
Sets the log level for Mama.
Parameters:
Return: mama_status return code can be one of: MAMA_STATUS_NULL_ARG MAMA_STATUS_PLATFORM MAMA_STATUS_OK
MAMAExpDLL MamaLogLevel mama_getLogLevel(
void
)
Returns the current log level for Mama.
Return: MamaLogLevel.
MAMAExpDLL mama_status mama_setLogSize(
unsigned long size
)
Set the maxmum size of the log file (bytes).
Parameters:
Return: mama_status return code can be one of: MAMA_STATUS_PLATFORM MAMA_STATUS_OK
When this size is reached the logsize callback is called, or if no callback is set then the default action is to overwrite file from the start. Default max size is 500 Mb
MAMAExpDLL mama_status mama_setNumLogFiles(
int numFiles
)
Set the number of rolled logfiles to keep before overwriting.
Parameters:
Return: mama_status return code can be one of: MAMA_STATUS_PLATFORM MAMA_STATUS_OK
Default is 10.
MAMAExpDLL mama_status mama_setLogFilePolicy(
mamaLogFilePolicy policy
)
Set the policy regarding how to handle files when Max file size is reached.
Parameters:
Return: mama_status return code can be one of: MAMA_STATUS_PLATFORM MAMA_STATUS_OK
Default is LOGFILE_UNBOUNDED.
MAMAExpDLL mama_status mama_setAppendToLogFile(
int append
)
Set append to existing log file.
Parameters:
Return: mama_status return code can be one of: MAMA_STATUS_PLATFORM MAMA_STATUS_OK
MAMAExpDLL int mama_loggingToFile(
void
)
Return status of loggingToFile.
Return: Boolean value indication whether logginToFile is set.
MAMAExpDLL mama_status mama_setLogSizeCb(
logSizeCbType logCallbacks
)
Set a callback for when the max log size is reached.
Parameters:
Return: mama_status return code can be one of: MAMA_STATUS_NULL_ARG MAMA_STATUS_PLATFORM MAMA_STATUS_OK
This can be used to override the default action which is to wrap the file and continue logging at the beginning
MAMAExpDLL const char * mama_logLevelToString(
MamaLogLevel level
)
Return string version of log level.
Parameters:
MAMAExpDLL int mama_tryStringToLogLevel(
const char * s,
MamaLogLevel * level
)
Try to convert string to log level.
Parameters:
Return non-zero for success, zero for failure. The string comparison is case insensitive.
MAMAExpDLL const char * mama_logPolicyToString(
mamaLogFilePolicy level
)
Return string version of log policy.
Parameters:
MAMAExpDLL int mama_tryStringToLogPolicy(
const char * s,
mamaLogFilePolicy * policy
)
Try to convert string to log policy.
Parameters:
Return non-zero for success, zero for failure. The string comparison is case insensitive.
MAMAExpDLL int mama_logIncrementVerbosity(
MamaLogLevel * level
)
Increase by one log level the verbosity of a MamaLogLevel variable.
Parameters:
Return: boolean value, 1 it the log level was incremented successfully.
If the level is already at the maximum verbosity it will be unchanged after calling the function, otherwise the level will be incremented. Returns zero if level is not changed, or non-zero if it is changed If an unrecognized level is passed, the function will return non-zero and the variable will be set to the minimum verbosity
MAMAExpDLL int mama_logDecrementVerbosity(
MamaLogLevel * level
)
Decrease by one log level the verbosity of a MamaLogLevel variable.
Parameters:
Return: boolean value, 1 it the log level was decremented successfully.
If the level is already at the minimum verbosity it will be unchanged after calling the function, otherwise the level will be decremented. Returns zero if level is not changed, or non-zero if it is changed If an unrecognized level is passed, the function will return non-zero and the variable will be set to the maximum verbosity
MAMAExpDLL mama_status mama_logForceRollLogFiles(
void
)
Force rolling the log file.
Return: The status of the operation.
MAMAExpDLL void mama_logDestroy(
void
)
Destroy memory held by the logging.
void mama_loginit(
void
)
Setup MAMA Logging.
This will setup all the default values from the mama.properties file
MAMAExpDLL MamaLogLevel gMamaLogLevel;
The current log level within the API deprecated - The helper functions should be used instead of this
MAMAExpDLL FILE * gMamaLogFile;
The file to which all logging will be written by default deprecated - The helper functions should be used instead of this
/* $Id$
*
* OpenMAMA: The open middleware agnostic messaging API
* Copyright (C) 2011 NYSE Technologies, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef MamaLogH__
#define MamaLogH__
#include <stdio.h>
#include <mama/config.h>
#include <stdarg.h>
#ifdef __cplusplus
extern "C"
{
#endif
#include "mama/status.h"
typedef enum
{
MAMA_LOG_LEVEL_OFF = 0,
MAMA_LOG_LEVEL_SEVERE = 1,
MAMA_LOG_LEVEL_ERROR = 2,
MAMA_LOG_LEVEL_WARN = 3,
MAMA_LOG_LEVEL_NORMAL = 4,
MAMA_LOG_LEVEL_FINE = 5,
MAMA_LOG_LEVEL_FINER = 6,
MAMA_LOG_LEVEL_FINEST = 7
} MamaLogLevel;
typedef enum
{
LOGFILE_UNBOUNDED = 1,
LOGFILE_ROLL = 2,
LOGFILE_OVERWRITE = 3,
LOGFILE_USER = 4
} mamaLogFilePolicy;
typedef void (MAMACALLTYPE *mamaLogCb) (MamaLogLevel level, const char *format, va_list ap);
typedef void (MAMACALLTYPE *mamaLogCb2) (MamaLogLevel level, const char *message);
typedef void (MAMACALLTYPE *mamaLogCb3) (const char* prefix, const char *format, va_list ap);
typedef void (*logSizeCbType) (void);
MAMAExpDLL
extern void MAMACALLTYPE
mama_logDefault (MamaLogLevel level, const char *format, va_list ap);
MAMAExpDLL
extern void MAMACALLTYPE
mama_logDefault2 (MamaLogLevel level, const char *message);
MAMAExpDLL
extern void
mama_logStdout (MamaLogLevel level, const char *format, ...);
MAMAExpDLL
extern void MAMACALLTYPE
mama_forceLogDefault (MamaLogLevel level, const char *format, va_list ap);
MAMAExpDLL
extern void MAMACALLTYPE
mama_forceLogPrefixDefault (const char* prefix,
const char* format,
va_list ap);
MAMAExpDLL
extern MamaLogLevel gMamaLogLevel;
MAMAExpDLL
extern FILE* gMamaLogFile;
MAMAExpDLL
extern mama_status
mama_enableLogging (FILE *file, MamaLogLevel level);
MAMAExpDLL
extern mama_status
mama_logToFile (const char* file, MamaLogLevel level);
MAMAExpDLL
extern mama_status
mama_disableLogging(void);
MAMAExpDLL
extern void
mama_log (MamaLogLevel level, const char *format, ...);
MAMAExpDLL
extern void MAMACALLTYPE
mama_log2 (MamaLogLevel level, const char *message);
MAMAExpDLL
extern void
mama_logVa (MamaLogLevel level, const char *format, va_list args);
MAMAExpDLL
extern void
mama_forceLogVa(const char *format, va_list args);
MAMAExpDLL
extern void
mama_forceLogVaWithPrefix (const char* prefix,
const char* format,
va_list args);
MAMAExpDLL
extern void
mama_forceLog (MamaLogLevel level, const char *format, ...);
MAMAExpDLL
extern void
mama_forceLogWithPrefix (const char* prefix,
const char* format,
...);
MAMAExpDLL
extern mama_status
mama_setLogCallback (mamaLogCb callback);
MAMAExpDLL
extern mama_status
mama_setLogCallback2 (mamaLogCb2 callback);
MAMAExpDLL
extern mama_status
mama_setForceLogCallback (mamaLogCb callback);
MAMAExpDLL
extern mama_status
mama_setForceLogPrefixCallback (mamaLogCb3 callback);
MAMAExpDLL
extern mama_status
mama_setLogLevel (MamaLogLevel level);
MAMAExpDLL
extern MamaLogLevel
mama_getLogLevel (void);
MAMAExpDLL
extern mama_status
mama_setLogSize (unsigned long size);
MAMAExpDLL
extern mama_status
mama_setNumLogFiles(int numFiles);
MAMAExpDLL
extern mama_status
mama_setLogFilePolicy(mamaLogFilePolicy policy);
MAMAExpDLL
extern mama_status
mama_setAppendToLogFile(int append);
MAMAExpDLL
extern int
mama_loggingToFile(void);
MAMAExpDLL
extern mama_status
mama_setLogSizeCb(logSizeCbType logCallbacks);
MAMAExpDLL
extern const char*
mama_logLevelToString(MamaLogLevel level);
MAMAExpDLL
extern int
mama_tryStringToLogLevel(const char* s, MamaLogLevel* level);
MAMAExpDLL
extern const char*
mama_logPolicyToString(mamaLogFilePolicy level);
MAMAExpDLL
extern int
mama_tryStringToLogPolicy(const char* s, mamaLogFilePolicy* policy);
MAMAExpDLL
extern int
mama_logIncrementVerbosity(MamaLogLevel* level);
MAMAExpDLL
extern int
mama_logDecrementVerbosity(MamaLogLevel* level);
MAMAExpDLL
extern mama_status
mama_logForceRollLogFiles(void);
MAMAExpDLL
extern void
mama_logDestroy(void);
void
mama_loginit (void);
#ifdef __cplusplus
} /* MAMAExpDLL
extern "C" */
#endif
#endif /* MAMA_LOG_H__ */
Updated on 2023-03-31 at 15:29:16 +0100