A simple PS3 /PSL1GHT library that provides basic debug logging over the network (TCP/UDP) or to a local file. The library also includes additional helper functions to save screenshots in PNG and encode files in Base64.
By default, the logger will send debug messages to UDP multicast address 239.255.0.100:30000
.
To receive them you can use socat or netcat on your PC:
socat udp4-recv:30000,ip-add-membership=239.255.0.100:0.0.0.0 -
You can find a sample PSL1GHT app using the library here.
Build the library with: make
Install the library to your PSL1GHT setup with: make install
You need to initialize the library before you can send logs to the network or file.
The default init will send log messages to UDP multicast address 239.255.0.100:30000
.
int dbglogger_init(void);
You can initialize the library with a custom string, to override the default init.
int dbglogger_init_str(const char* ini_str);
Example:
dbglogger_init_str("tcp:192.168.1.123:18194");
More example init strings:
"udp:239.255.0.100:30000"
"file:/dev_hdd0/tmp/dbglogger.log"
You can also initialize the library with custom parameters, to override the default init.
typedef enum {
NO_LOGGER,
UDP_LOGGER,
TCP_LOGGER,
FILE_LOGGER
} LOGGER_MODES;
int dbglogger_init_mode(const unsigned int log_mode, const char* dest, const u_short port);
Example:
dbglogger_init_mode(TCP_LOGGER, "192.168.1.123", 18999);
You can initialize the library with a custom string read from a text file, to override the default init.
int dbglogger_init_file(const char* ini_file);
Example: dbglogger_init_file("/dev_hdd0/tmp/mylogger.ini");
A function to print using a format string similar to printf()
void dbglogger_printf(const char* fmt, ...);
A function to print using a format string, with a timestamp and carriage return. e.g. [YYYY-MM-DD HH:MM:SS] my log \n
similar to printf()
void dbglogger_log(const char* fmt, ...);
If you no longer need to keep the network open for logging, you can shutdown the logger.
int dbglogger_stop(void);
A function to save a screenshot in PNG format. Supports alpha channel.
int dbglogger_screenshot(const char* filename, const unsigned short alpha);
Example (PNG with alpha):
dbglogger_screenshot("/dev_hdd0/tmp/myscreen.png", 1);
A function to save a screenshot in PNG format, with a predefined file name. Supports alpha channel.
The screenshot will be placed in /dev_hdd0/tmp/screenshot_YYYY_MM_DD_HH_MM_SS.png
int dbglogger_screenshot_tmp(const unsigned short alpha);
A helper method to encode a binary file in Base64 and send it thru the initialized logger method (e.g., TCP, UDP or file)
int dbglogger_b64encode(const char* filename);