# log.c File Reference

`#include "magick/studio.h"`
`#include "magick/blob.h"`
`#include "magick/client.h"`
`#include "magick/configure.h"`
`#include "magick/exception.h"`
`#include "magick/exception-private.h"`
`#include "magick/hashmap.h"`
`#include "magick/log.h"`
`#include "magick/memory_.h"`
`#include "magick/option.h"`
`#include "magick/semaphore.h"`
`#include "magick/timer.h"`
`#include "magick/string_.h"`
`#include "magick/token.h"`
`#include "magick/utility.h"`
`#include "magick/version.h"`
`#include "magick/xml-tree.h"`
`#include <pthread.h>`

## Data Structures

struct | _EventInfo
struct | _HandlerInfo
struct | _LogInfo

## Defines

#define | LogFilename "log.xml"
#define | MegabytesToBytes(value) ((MagickSizeType) (value)*1024*1024)

## Typedefs

typedef struct _EventInfo | EventInfo
typedef struct _HandlerInfo | HandlerInfo

## Enumerations

enum | LogHandlerType { UndefinedHandler = 0x0000, NoHandler = 0x0000, ConsoleHandler = 0x0001, StdoutHandler = 0x0002, StderrHandler = 0x0004, FileHandler = 0x0008, DebugHandler = 0x0010, EventHandler = 0x0020 }

## Functions

static LogHandlerType | ParseLogHandlers (const char *)
static MagickBooleanType | InitializeLogList (ExceptionInfo *)
static MagickBooleanType | LoadLogLists (const char *, ExceptionInfo *)
MagickExport void | CloseMagickLog (void)
static void * | DestroyLogElement (void *log_info)
MagickExport void | DestroyLogList (void)
MagickExport const LogInfo * | GetLogInfo (const char *name, ExceptionInfo *exception)
static int | LogInfoCompare (const void *x, const void *y)
MagickExport const LogInfo ** | GetLogInfoList (const char *pattern, unsigned long *number_preferences, ExceptionInfo *exception)
static int | LogCompare (const void *x, const void *y)
MagickExport char ** | GetLogList (const char *pattern, unsigned long *number_preferences, ExceptionInfo *exception)
MagickExport const char * | GetLogName (void)
MagickExport MagickBooleanType | IsEventLogging (void)
MagickExport MagickBooleanType | ListLogInfo (FILE *file, ExceptionInfo *exception)
static unsigned long | GetLogThreadId (void)
static char * | TranslateEvent (const LogEventType magick_unused(type), const char *module, const char *function, const unsigned long line, const char *domain, const char *event)
static char * | TranslateFilename (const LogInfo *log_info)
MagickBooleanType | LogMagickEventList (const LogEventType type, const char *module, const char *function, const unsigned long line, const char *format, va_list operands)
MagickBooleanType | LogMagickEvent (const LogEventType type, const char *module, const char *function, const unsigned long line, const char *format,...)
static MagickBooleanType | LoadLogList (const char *xml, const char *filename, const unsigned long depth, ExceptionInfo *exception)
MagickExport LogEventType | SetLogEventMask (const char *events)
MagickExport void | SetLogFormat (const char *format)
MagickExport const char * | SetLogName (const char *name)

## Variables

static const HandlerInfo | LogHandlers []
static const char * | LogMap
static char | log_name [MaxTextExtent] = "Magick"
static LinkedListInfo * | log_list = (LinkedListInfo *) NULL
static SemaphoreInfo * | log_semaphore = (SemaphoreInfo *) NULL
static volatile MagickBooleanType | instantiate_log = MagickFalse

## Define Documentation

#define LogFilename "log.xml"

#define MegabytesToBytes | ( | value |  | ) | ((MagickSizeType) (value)*1024*1024)

## Typedef Documentation

typedef struct _EventInfo EventInfo

typedef struct _HandlerInfo HandlerInfo

## Enumeration Type Documentation

enum LogHandlerType

Enumerator:

  UndefinedHandler |
  NoHandler |
  ConsoleHandler |
  StdoutHandler |
  StderrHandler |
  FileHandler |
  DebugHandler |
  EventHandler |

## Function Documentation

MagickExport void CloseMagickLog | ( | void |  | ) |

static void* DestroyLogElement | ( | void * | log_info | ) | `[static]`

MagickExport void DestroyLogList | ( | void |  | ) |

MagickExport const LogInfo* GetLogInfo | ( | const char * | name,
|  | ExceptionInfo * | exception |
| ) |  |  |

MagickExport const LogInfo** GetLogInfoList | ( | const char * | pattern,
|  | unsigned long * | number_preferences,
|  | ExceptionInfo * | exception |
| ) |  |  |

MagickExport char** GetLogList | ( | const char * | pattern,
|  | unsigned long * | number_preferences,
|  | ExceptionInfo * | exception |
| ) |  |  |

MagickExport const char* GetLogName | ( | void |  | ) |

static unsigned long GetLogThreadId | ( | void |  | ) | `[static]`

static MagickBooleanType InitializeLogList | ( | ExceptionInfo * | exception | ) | `[static]`

MagickExport MagickBooleanType IsEventLogging | ( | void |  | ) |

MagickExport MagickBooleanType ListLogInfo | ( | FILE * | file,
|  | ExceptionInfo * | exception |
| ) |  |  |

static MagickBooleanType LoadLogList | ( | const char * | xml,
|  | const char * | filename,
|  | const unsigned long | depth,
|  | ExceptionInfo * | exception |
| ) |  |  | `[static]`

static MagickBooleanType LoadLogLists | ( | const char * | filename,
|  | ExceptionInfo * | exception |
| ) |  |  |

static int LogCompare | ( | const void * | x,
|  | const void * | y |
| ) |  |  | `[static]`

static int LogInfoCompare | ( | const void * | x,
|  | const void * | y |
| ) |  |  | `[static]`

MagickBooleanType LogMagickEvent | ( | const LogEventType | type,
|  | const char * | module,
|  | const char * | function,
|  | const unsigned long | line,
|  | const char * | format,
|  |  | ... |
| ) |  |  |

MagickBooleanType LogMagickEventList | ( | const LogEventType | type,
|  | const char * | module,
|  | const char * | function,
|  | const unsigned long | line,
|  | const char * | format,
|  | va_list | operands |
| ) |  |  |

static LogHandlerType ParseLogHandlers | ( | const char * | handlers | ) | `[static]`

MagickExport LogEventType SetLogEventMask | ( | const char * | events | ) |

MagickExport void SetLogFormat | ( | const char * | format | ) |

MagickExport const char* SetLogName | ( | const char * | name | ) |

static char* TranslateEvent | ( | const LogEventType | magick_unused(type),
|  | const char * | module,
|  | const char * | function,
|  | const unsigned long | line,
|  | const char * | domain,
|  | const char * | event |
| ) |  |  | `[static]`

static char* TranslateFilename | ( | const LogInfo * | log_info | ) | `[static]`

## Variable Documentation

volatile MagickBooleanType instantiate_log = MagickFalse`[static]`

LinkedListInfo* log_list = (LinkedListInfo *) NULL`[static]`

char log_name[MaxTextExtent] = "Magick"`[static]`

SemaphoreInfo* log_semaphore = (SemaphoreInfo *) NULL`[static]`

const HandlerInfo LogHandlers[]`[static]`

Initial value:

      {
        { "console", ConsoleHandler },
        { "debug", DebugHandler },
        { "event", EventHandler },
        { "file", FileHandler },
        { "none", NoHandler },
        { "stderr", StderrHandler },
        { "stdout", StdoutHandler },
        { (char *) NULL, UndefinedHandler }
      }

const char* LogMap`[static]`

Initial value:

     (const char *)
        "<?xml version=\"1.0\"?>"
        "<logmap>"
        "  <log events=\"None\" />"
        "  <log output=\"console\" />"
        "  <log filename=\"Magick-%d.log\" />"
        "  <log format=\"%t %r %u %v %d %c[%p]: %m/%f/%l/%d\n  %e\" />"
        "</logmap>"