| ARX 1.0 The next-generation open source augmented reality toolkit.

Loading...
Searching...
No Matches
Macros | Functions | Variables
log.c File Reference
`#include <ARX/ARUtil/log.h>`
`#include <pthread.h>`
Include dependency graph for log.c:

## Macros
#define | AR_LOG_WRONG_THREAD_BUFFER_SIZE 4096

## Functions
void | arLogSetLogger (AR_LOG_LOGGER_CALLBACK callback, int callBackOnlyIfOnSameThread)
| Divert logging to a callback, or revert to default logging.
void | arLog (const char *tag, const int logLevel, const char *format,...)
| Write a string to the current logging facility.
void | arLogv (const char *tag, const int logLevel, const char *format, va_list ap)

## Variables
int | arLogLevel = AR_LOG_LEVEL_DEFAULT
| Sets the severity level. Log messages below the set severity level are not logged.

## Macro Definition Documentation

## ◆ AR_LOG_WRONG_THREAD_BUFFER_SIZE

#define AR_LOG_WRONG_THREAD_BUFFER_SIZE 4096

## Function Documentation

## ◆ arLog()

void arLog | ( | const char * | tag,
|  | const int | logLevel,
|  | const char * | format,
|  |  | ...
| ) |  |

Write a string to the current logging facility.

The default logging facility varies by platform, but on Unix-like platforms is typically the standard error file descriptor. However, logging may be redirected to some other facility by arLogSetLogger.

Newlines are not automatically appended to log output.

Parameters

  tag | A tag to supply to an OS-specific logging function to specify the source of the error message. May be NULL, in which case "libAR" will be used.
  logLevel | The severity of the log message. Defined in lt;ARUtil/log.h>. Log output is written to the logging facility provided the logLevel meets or exceeds the minimum level specified in global arLogLevel.
  format | Log format string, in the form of printf().

See also
  arLogLevel
  arLogSetLogger

Here is the call graph for this function:

## ◆ arLogSetLogger()

void arLogSetLogger | ( | AR_LOG_LOGGER_CALLBACK | callback,
|  | int | callBackOnlyIfOnSameThread
| ) |  |

Divert logging to a callback, or revert to default logging.

The default logging facility varies by platform, but on Unix-like platforms is typically the standard error file descriptor. However, logging may be redirected to some other facility by this function.

Parameters

  callback | The function which will be called with the log output, or NULL to cancel redirection.
  callBackOnlyIfOnSameThread | If non-zero, then the callback will only be called if the call to arLog is made on the same thread as the thread which called this function, and if the arLog call is made on a different thread, log output will be buffered until the next call to arLog on the original thread.

The purpose of this is to prevent logging from secondary threads in cases where the callback model of the target platform precludes this.

See also
  arLog

## ◆ arLogv()

void arLogv | ( | const char * | tag,
|  | const int | logLevel,
|  | const char * | format,
|  | va_list | ap
| ) |  |

## Variable Documentation

## ◆ arLogLevel

int arLogLevel = AR_LOG_LEVEL_DEFAULT

Sets the severity level. Log messages below the set severity level are not logged.

All calls to artoolkitX's logging facility include a "log level" parameter, which specifies the severity of the log message. (The severities are defined in <ARUtil/log.h>.) Setting this global allows for filtering of log messages. All log messages lower than the set level will not be logged by arLog(). Note that debug log messages created using the ARLOGd() macro will be logged only in debug builds, irrespective of the log level.

See also
  arLog