Skip to content

Commit

Permalink
Added in SDL2::Log file. fixes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartik Thakore committed Aug 8, 2013
1 parent a609b80 commit 01647ac
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
28 changes: 28 additions & 0 deletions lib/SDL2/Log.pm
@@ -0,0 +1,28 @@
package SDL2::Log;
use strict;
use warnings;
use vars qw(@ISA @EXPORT @EXPORT_OK);
require Exporter;
require DynaLoader;

use SDL2::Constants ':SDL2::Log';
our @ISA = qw(Exporter DynaLoader);

use SDL2::Internal::Loader;
if (check_and_load(__PACKAGE__)) {
bootstrap SDL2::Log;
}
else {
warn "WARNING: " . __PACKAGE__ . " is not available\n";
}

use base 'Exporter';

our @EXPORT = @{ $SDL2::Constants::EXPORT_TAGS{'SDL2::Log'} };

our %EXPORT_TAGS = (
all => \@EXPORT,
priority => $SDL2::Constants::EXPORT_TAGS{'SDL2::Log/type'}
);

1;
2 changes: 2 additions & 0 deletions src/Core/Log.xs
Expand Up @@ -19,13 +19,15 @@ log_set_all_priority ( pri )
CODE:
SDL_LogSetAllPriority( pri );


void
log_set_priority ( cat, pri )
int cat
int pri
CODE:
SDL_LogSetPriority( cat, pri );


int
log_get_priority ( cat )
int cat
Expand Down
4 changes: 1 addition & 3 deletions t/104_sdl2_log.t
Expand Up @@ -19,8 +19,6 @@ SDL2::Log::reset_priorities();

isnt( SDL2::Log::get_priority( 0 ), SDL_LOG_PRIORITY_VERBOSE );

SDL2::Log::set_all_priority ( SDL_LOG_PRIORITY_VERBOSE );

SDL2::Log::log( "Foo %d" , 10);
pass('Log');
SDL2::Log::verbose( "Voo %d" , 10);
Expand All @@ -33,7 +31,7 @@ SDL2::Log::warn( "Voo %d" , 10);
pass('Warn');
SDL2::Log::error( "Voo %d" , 10);
pass('Error');
SDL2::Log::message( "Voo %d" , SDL_LOG_PRIORITY_INFO, 10);
SDL2::Log::message( "Voo %d" , 5, 10);
pass('Message');


Expand Down

0 comments on commit 01647ac

Please sign in to comment.