GraphicsMagick

- Home
- Project
- Download
- Install
- Source
- News
- Utilities
- Programming
- Reference

# log

Event logging support

Contents

- IsEventLogging

- IsEventLogged

- LogMagickEvent

- SetLogDefaultEventType

- SetLogDefaultGenerations

- SetLogDefaultLimit

- SetLogDefaultLogMethod

- SetLogDefaultOutputType

- SetLogDefaultFileName

- SetLogEventMask

- SetLogFormat

- SetLogMethod

# IsEventLogging

## Synopsis

    MagickBool IsEventLogging( void );

## Description

IsEventLogging() returns MagickTrue if logging of events is enabled, otherwise MagickFalse. This can be used to enable logging code which is otherwise not needed.

The format of the IsEventLogging method is:

    MagickBool IsEventLogging( void );

# IsEventLogged

## Synopsis

    MagickBool IsEventLogged( const ExceptionType type );

## Description

IsEventLogged() returns MagickTrue if logging of events for the specified exception type is enabled, otherwise MagickFalse. This can be used to enable logging code which is otherwise not needed.

The format of the IsEventLogging method is:

    MagickBool IsEventLogged( const ExceptionType type );

# LogMagickEvent

## Synopsis

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

## Description

LogMagickEvent() logs an event as determined by the current logging configuration. If an error occurs, MagickFail is returned otherwise MagickPass.

The format of the LogMagickEvent method is:

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

type:

  The event type.

filename:

  The source module filename.

function:

  The function name.

line:

  The line number of the source module.

format:

  The output format.

# SetLogDefaultEventType

## Synopsis

    void SetLogDefaultEventType( const char *events );

## Description

SetLogDefaultEventType() accepts a comma-delimited list (Annotate, Blob, Cache, Coder, Configure, Deprecate, Error, Exception, FatalError, Information, Locale, Option, Render, Resource, TemporaryFile, Transform, User, Warning, or X11) that determines the default set of events to log. All other events are ignored. By default, no logging is enabled.

This function should be called prior to InitializeMagick() since it provides defaults used by InitializeMagick() while the logging system is initialized. The events may be modified later after InitializeMagick() has been called using the SetLogEventMask() function.

The format of SetLogDefaultEventType method is:

    void SetLogDefaultEventType( const char *events );

A description of each parameter follows:

events:

  Comma-separated list of events to report.

# SetLogDefaultGenerations

## Synopsis

    void SetLogDefaultGenerations( const unsigned long generations );

## Description

SetLogDefaultGenerations() specifies the maximum number of log files to maintain before circulating back to overwrite the first name.

This function should be called prior to InitializeMagick() since it provides defaults used by InitializeMagick() while the logging system is initialized.

The format of SetLogDefaultGenerations method is:

    void SetLogDefaultGenerations( const unsigned long generations );

A description of each parameter follows:

generations:

  Number of log files to maintain before circulating back to the first name.

# SetLogDefaultLimit

## Synopsis

    void SetLogDefaultLimit( const unsigned long limit );

## Description

SetLogDefaultLimit() specifies the maximum number of logging events which may occur before creating a new log file.

This function should be called prior to InitializeMagick() since it provides defaults used by InitializeMagick() while the logging system is initialized.

The format of SetLogDefaultLimit method is:

    void SetLogDefaultLimit( const unsigned long limit );

A description of each parameter follows:

limit:

  Maximum number of logging events before creating a new log file.

# SetLogDefaultLogMethod

## Synopsis

    void SetLogDefaultLogMethod( const LogMethod method );

## Description

SetLogDefaultLogMethod() provides a call-back function to be invoked for each log event when the logging method type is MethodOutput. This call-back function is supported when MethodOutput is enabled in the log output type. MethodOutput is automatically enabled if a call-back function is provided, and disabled if the call-back function is NULL.

This function should be called prior to InitializeMagick() since it provides defaults used by InitializeMagick() while the logging system is initialized.

The format of SetLogDefaultLogMethod method is:

    void SetLogDefaultLogMethod( const LogMethod method );

A description of each parameter follows:

method:

  Call-back function to be invoked for each log event.

# SetLogDefaultOutputType

## Synopsis

    void SetLogDefaultOutputType( const LogOutputType output_type );

## Description

SetLogDefaultOutputType() sets the logging output destination.

This function should be called prior to InitializeMagick() since it provides defaults used by InitializeMagick() while the logging system is initialized.

The format of SetLogDefaultOutputType method is:

    void SetLogDefaultOutputType( const LogOutputType output_type );

A description of each parameter follows:

output_type:

  The logging output destination. One of the enumerated values of LogOutputType.

# SetLogDefaultFileName

## Synopsis

    void SetLogDefaultFileName( const char *filename );

## Description

SetLogDefaultFileName() provides the file name, or file path, to be written to for each log event. Place a %d in the file name in order to support multiple log generations. This setting is only used when the log output type uses an output file.

This function should be called prior to InitializeMagick() since it provides defaults used by InitializeMagick() while the logging system is initialized.

The format of SetLogDefaultFileName method is:

    void SetLogDefaultFileName( const char *filename );

A description of each parameter follows:

filename:

  File name, or file path to write log output to.

# SetLogEventMask

## Synopsis

    unsigned long SetLogEventMask( const char *events );

## Description

SetLogEventMask() accepts a comma-delimited list (Annotate, Blob, Cache, Coder, Configure, Deprecate, Error, Exception, FatalError, Information, Locale, Option, Render, Resource, TemporaryFile, Transform, User, Warning, or X11) that determines which events to log. All other events are ignored. By default, no logging is enabled. This method returns the updated log event mask.

The format of the SetLogEventMask method is:

    unsigned long SetLogEventMask( const char *events );

A description of each parameter follows:

events:

  log these events.

# SetLogFormat

## Synopsis

    void SetLogFormat( const char *format );

## Description

SetLogFormat() sets the format for the "human readable" log record. The format specification supports these special format characters:

%d domain, %e event, %f function, %l line, %m module, %p process ID, %r real CPU time, %t wall clock time, %u user CPU time, %% percent sign, n newline, r carriage return

The format of the LogMagickFormat method is:

    void SetLogFormat( const char *format );

A description of each parameter follows:

format:

  The log record format.

# SetLogMethod

## Synopsis

    void SetLogMethod( LogMethod method );

## Description

SetLogMethod() sets the method to be called when logging.

The format of the SetLogMethod method is:

    void SetLogMethod( LogMethod method );

A description of each parameter follows:

method:

  pointer to a method of type LogMethod that will be called when LogMagickEvent is called. Pass a null pointer to remove a registered method.

Copyright © GraphicsMagick Group 2002 - 2024