NAME

SDL2::log - Simple Log Messages with Categories and Priorities

SYNOPSIS

use SDL2 qw[:log];

DESCRIPTION

By default, logs are quiet but if you're debugging SDL you might want:

SDL_LogSetAllPriority( SDL_LOG_PRIORITY_WARN );

Here's where the messages go on different platforms:

Windows: debug output stream
Android: log output
Others: standard error output (stderr)

Functions

These functions may be imported by name or with the :log tag.

SDL_LogSetAllPriority( ... )

Set the priority of all log categories.

Expected parameters include:

priority - the SDL_LogPriority to assign

SDL_LogSetPriority( ... )

Set the priority of a particular log category.

Expected parameters include:

category - the category to assign a priority to
priority - the SDL_LogPriority to assign

SDL_LogGetPriority( ... )

Get the priority of a particular log category.

Expected parameters include:

category - the category to query

Returns the SDL_LogPriority for the requested category.

SDL_LogResetPriorities( )

Reset all priorities to default.

This is called by SDL_Quit( ).

SDL_Log( ... )

Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO.

Expected parameters include:

fmt - a printf( ... ) style message format string
... - additional parameters matching % tokens in the fmt string, if any

SDL_LogVerbose( ... )

Log a message with SDL_LOG_PRIORITY_VERBOSE.

Expected parameters include:

category - the category of the message
fmt - a printf( ... ) style message format string
... - additional parameters matching % tokens in the fmt string, if any

SDL_LogDebug( ... )

Log a message with SDL_LOG_PRIORITY_DEBUG.

Expected parameters include:

category - the category of the message
fmt - a printf( ... ) style message format string
... - additional parameters matching % tokens in the fmt string, if any

SDL_LogInfo( ... )

Log a message with SDL_LOG_PRIORITY_INFO.

Expected parameters include:

category - the category of the message
fmt - a printf( ... ) style message format string
... - additional parameters matching % tokens in the fmt string, if any

SDL_LogWarn( ... )

Log a message with SDL_LOG_PRIORITY_WARN.

Expected parameters include:

category - the category of the message
fmt - a printf( ... ) style message format string
... - additional parameters matching % tokens in the fmt string, if any

SDL_LogError( ... )

Log a message with SDL_LOG_PRIORITY_ERROR.

Expected parameters include:

category - the category of the message
fmt - a printf( ... ) style message format string
... - additional parameters matching % tokens in the fmt string, if any

SDL_LogCritical( ... )

Log a message with SDL_LOG_PRIORITY_CRITICAL.

Expected parameters include:

category - the category of the message
fmt - a printf( ... ) style message format string
... - additional parameters matching % tokens in the fmt string, if any

SDL_LogMessage( ... )

Log a message with the specified category and priority.

Expected parameters include:

category - the category of the message
priority - the priority of the message
fmt - a printf( ... ) style message format string
... - additional parameters matching % tokens in the fmt string, if any

SDL_LogMessageV( ... )

Expected parameters include:

category - the category of the message
priority - the priority of the message
fmt - a printf( ... ) style message format string
... - additional parameters matching % tokens in the fmt string, if any

SDL_LogGetOutputFunction( ... )

Get the current log output function.

Expected parameters include:

callback - pointer which will be filled in with the current log callback
userdata - a pointer which will be filled in with the pointer that is passed to callback

SDL_LogSetOutputFunction( ... )

Replace the default log output function with one of your own.

Expected parameters include:

callback - an SDL_LogOutputFunction to call instead of the default
userdata - a pointer that is passed to callback

Defined Values and Enumerations

These might be imported with the given tag, by name, or with the <:log> tag.

SDL_MAX_LOG_MESSAGE

The maximum size of a log message.

Messages longer than the maximum size will be truncated.

SDL_LogCategory

The predefined log categories

By default the application category is enabled at the INFO level, the assert category is enabled at the WARN level, test is enabled at the VERBOSE level and all other categories are enabled at the CRITICAL level.

SDL_LOG_CATEGORY_APPLICATION
SDL_LOG_CATEGORY_ERROR
SDL_LOG_CATEGORY_ASSERT
SDL_LOG_CATEGORY_SYSTEM
SDL_LOG_CATEGORY_AUDIO
SDL_LOG_CATEGORY_VIDEO
SDL_LOG_CATEGORY_RENDER
SDL_LOG_CATEGORY_INPUT
SDL_LOG_CATEGORY_TEST
SDL_LOG_CATEGORY_RESERVED1 - These are reserved for future SDL library use
SDL_LOG_CATEGORY_RESERVED2
SDL_LOG_CATEGORY_RESERVED3
SDL_LOG_CATEGORY_RESERVED4
SDL_LOG_CATEGORY_RESERVED5
SDL_LOG_CATEGORY_RESERVED6
SDL_LOG_CATEGORY_RESERVED7
SDL_LOG_CATEGORY_RESERVED8
SDL_LOG_CATEGORY_RESERVED9
SDL_LOG_CATEGORY_RESERVED10
SDL_LOG_CATEGORY_CUSTOM

Beyond this point is reserved for application use, e.g.

enum {
    MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM,
    MYAPP_CATEGORY_AWESOME2,
    MYAPP_CATEGORY_AWESOME3,
    ...
};

SDL_LogPriority

The predefined log priorities.

SDL_LOG_PRIORITY_VERBOSE
SDL_LOG_PRIORITY_DEBUG
SDL_LOG_PRIORITY_INFO
SDL_LOG_PRIORITY_WARN
SDL_LOG_PRIORITY_ERROR
SDL_LOG_PRIORITY_CRITICAL
SDL_NUM_LOG_PRIORITIES

SDL_LogOutputFunction

The prototype for the log output callback function.

This function is called by SDL when there is new text to be logged.

Parameters to expect include:

userdata - what was passed as userdata to SDL_LogSetOutputFunction( ... )
category - the category of the message
priority - the priority of the message
message - the message being output

LICENSE

Copyright (C) Sanko Robinson.

This library is free software; you can redistribute it and/or modify it under the terms found in the Artistic License 2. Other copyrights, terms, and conditions may apply to data transmitted through this module.

AUTHOR

Sanko Robinson <sanko@cpan.org>