log.c 663 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

#include "libretro.h"

static retro_log_printf_t log_cb;

void init_log(retro_environment_t environ_cb)
{
Libretro-Admin's avatar
Libretro-Admin committed
12
13
   struct retro_log_callback log;
   if (environ_cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log))
14
      log_cb = log.log;
Libretro-Admin's avatar
Libretro-Admin committed
15
   else
16
17
18
19
20
      log_cb = NULL;
}

void handle_error( const char* error )
{
Libretro-Admin's avatar
Libretro-Admin committed
21
22
23
24
25
26
   char str [256];
   if(error)
   {
      sprintf( str, "Error: %s", error );
      log_cb(RETRO_LOG_ERROR, str );
   }
27
28
29
30
}

void handle_info( const char* info )
{
Libretro-Admin's avatar
Libretro-Admin committed
31
32
33
34
35
36
   char str [256];
   if(info)
   {
      sprintf( str, "Info: %s\n", info );
      log_cb(RETRO_LOG_INFO, str );
   }
37
}