Skip to main content

BS2_SetDebugFileLogEx

+ v2.8.3 Log messages within the SDK can be output as a split file and used for debugging applications.

The fourth factor, fileMaxSizeMB, allows you to specify a maximum size per file, in MB.

If you set this value to 0, you will not proceed with file segmentation saving.

The file can be specified as either an absolute path or a relative path, and log messages that occur during subsequent SDK operations are automatically generated in that path. The file name stored at this time is YYYYMMDD_x.Take the form of log (_x is given sequentially from 0 whenever fileMaxSize is exceeded)

Declaration​

#include "BS_API.h"

int BS2_SetDebugFileLogEx(uint32_t level, uint32_t module, const char* logPath, int fileMaxSizeMB);

Parameter​

  • [In] level : Specify error level

    MacroValueDescription
    DEBUG_LOG_FATAL0x00000001Fatal Error
    DEBUG_LOG_ERROR0x00000002General Error
    DEBUG_LOG_WARN0x00000004Warning
    DEBUG_LOG_API0x00000008API Calls IN and OUT
    DEBUG_LOG_INFO0x00000010Information other than errors
    DEBUG_LOG_TRACE0x00000100SDK Self-Debugging Information
    DEBUG_LOG_SYSTEM0x0000000FOutput all error levels and general information
    DEBUG_LOG_OPERATION_ALL0x000000FFOutput all error levels
    DEBUG_LOG_ALL0xFFFFFFFFAll Information Output
  • [In] module : Specify a module

    MacroValueDescription
    DEBUG_MODULE_KEEP_ALIVE0x00000001Keep alive module
    DEBUG_MODULE_SOCKET_MANAGER0x00000002Socket Management Module
    DEBUG_MODULE_SOCKET_HANDLER0x00000004Socket Operation Module
    DEBUG_MODULE_DEVICE0x00000008Device Module
    DEBUG_MODULE_DEVICE_MANAGER0x00000010Device Management Module
    DEBUG_MODULE_EVENT_DISPATCHER0x00000020Event Handler Module
    DEBUG_MODULE_API0x00000040API
    DEBUG_MODULE_MISC0x00000080etc
    DEBUG_MODULE_PACKET0x00000100Communication Packet Processing Module
    DEBUG_MODULE_NOTIFY_MANAGER0x00000400Notify Processing Module
    DEBUG_MODULE_EVENT0x00000800USB event log processing module
    DEBUG_MODULE_USB0x00001000USB import processing module
    DEBUG_MODULE_ALL0xFFFFFFFFFull module
  • [In] logPath : Path to which the log file will be output

Return Value

If successfully done, BS_SDK_SUCCESS will be returned.

If there is an error, the corresponding error code will be returned.

Sample Code​

C++
const char* CURRENT_DIR = ".";
const int MAX_SIZE_LOG_FILE = 100; // 100MB
int sdkResult = BS2_SetDebugFileLogEx(DEBUG_LOG_ALL, DEBUG_MODULE_ALL, CURRENT_DIR, MAX_SIZE_LOG_FILE);
if (BS_SDK_SUCCESS != sdkResult)
{
printf("BS2_SetDebugFileLogEx call failed: %d", sdkResult);
return;
}
C#
const string CURRENT_DIR = ".";
const int MAX_SIZE_LOG_FILE = 100; // 100MB
IntPtr ptrDir = Marshal.StringToHGlobalAnsi(CURRENT_DIR);
result = (BS2ErrorCode)API.BS2_SetDebugFileLogEx(Constants.DEBUG_LOG_OPERATION_ALL, Constants.DEBUG_MODULE_ALL, ptrDir, MAX_SIZE_LOG_FILE);
Marshal.FreeHGlobal(ptrDir);
if (result != BS2ErrorCode.BS_SDK_SUCCESS)
{
Console.WriteLine("Got error({0}).", result);
return;
}
Was this page helpful?