#include <string.h>
#include <sys/syscall.h>
#include <sys/types.h>
-#include <FIoRegistry.h>
-#include <FIoFile.h>
#include <FAppTypes.h>
#include <FBaseLog.h>
#include <FBaseSysLog.h>
#include "FBase_StringConverter.h"
#include "FApp_AppInfo.h"
+extern "C" {
+#include <iniparser.h>
+}
+
using namespace Tizen::Base;
using namespace Tizen::Io;
using namespace Tizen::Base::Collection;
#define LOG_TAG_NULL ""
#endif
+void __InitializeLogLevel(dictionary *pDic);
+void __InitializePlatformModule(dictionary *pDic);
+
static const char LOG_TAG_ASSERT[] = "Assert";
+static const char FILE_DEBUGMODE[] = "/opt/etc/.debugmode";
bool iniLoaded = false;
char logTag[LOG_MODULE_NAME_LEN_MAX];
vconf_get_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, &appDebug);
- platformDebug = File::IsFileExist( "/opt/etc/.debugmode");
+ platformDebug = (0 == access(FILE_DEBUGMODE, F_OK));
snprintf(logTag, LOG_MODULE_NAME_LEN_MAX, "%s", appName);
logTag[LOG_MODULE_NAME_LEN_MAX - 1] = '\0';
va_start(args, pFormat);
vconf_get_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, &appDebug);
- platformDebug = File::IsFileExist( "/opt/etc/.debugmode");
+ platformDebug = (0 == access(FILE_DEBUGMODE, F_OK));
if( (platformDebug == false) && (appDebug == 0) )
{
bool platformDebug;
char logBody[LOG_LEN_MAX];
- platformDebug = File::IsFileExist( "/opt/etc/.debugmode");
+ platformDebug = (0 == access(FILE_DEBUGMODE, F_OK));
if(!platformDebug)
{
bool platformDebug;
va_list args;
- platformDebug = File::IsFileExist( "/opt/etc/.debugmode");
+ platformDebug = (0 == access(FILE_DEBUGMODE, F_OK));
if(!platformDebug)
{
{
iniLoaded = true;
- Registry reg;
-
- const String regPath(L"/opt/usr/etc/system-log.ini");
-
- result r;
+ dictionary *pDic;
+ pDic = iniparser_load("/opt/usr/etc/system-log.ini");
- r = reg.Construct(regPath, REG_OPEN_READ_ONLY, 0);
-
- if (IsFailed(r))
+ if (pDic == NULL)
{
ALOG(LOG_ERROR, LOG_TAG, "[EXCEPTION] opening ini file failed.\n");
return;
}
- __InitializeLogLevel(reg);
- __InitializePlatformModule(reg);
+ __InitializeLogLevel(pDic);
+ __InitializePlatformModule(pDic);
+
+ iniparser_freedict(pDic);
}
void
-__InitializeLogLevel(const Registry& reg)
+__InitializeLogLevel(dictionary *pDic)
{
- const String sectApp(L"Application");
- const String sectPlatform(L"Platform");
+ char sectApp[]="Application";
+ char sectPlatform[]="Platform";
- const String entryInfo(L"INFO");
- const String entryDebug(L"DEBUG");
- const String entryException(L"EXCEPTION");
+ char entryInfo[]="INFO";
+ char entryDebug[]="DEBUG";
+ char entryException[]="EXCEPTION";
- const String strYes(L"YES");
- String retString;
+ char strYes[]="YES";
+ char *pVal;
- result r;
+ char keyString[LOG_MODULE_NAME_LEN_MAX*2];
+ int retVal;
- r = reg.GetValue(sectApp, entryInfo, retString);
- if (IsFailed(r))
+ sprintf(keyString, "%s:%s", sectApp, entryInfo);
+ keyString[LOG_MODULE_NAME_LEN_MAX*2-1] = '\0';
+ pVal = iniparser_getstr(pDic, keyString);
+ if (pVal == NULL)
{
ALOG(LOG_ERROR, LOG_TAG, "[EXCEPTION] finding Application/INFO failed.\n");
return;
}
- logInfo.applicationInfoEnabled = retString.Equals(strYes);
- retString.Clear();
+ retVal = strcmp(strYes, pVal);
+ logInfo.applicationInfoEnabled = (retVal == 0);
- r = reg.GetValue(sectApp, entryDebug, retString);
- if (IsFailed(r))
+ sprintf(keyString, "%s:%s", sectApp, entryDebug);
+ keyString[LOG_MODULE_NAME_LEN_MAX*2-1] = '\0';
+ pVal = iniparser_getstr(pDic, keyString);
+ if (pVal == NULL)
{
ALOG(LOG_ERROR, LOG_TAG, "[EXCEPTION] finding Application/DEBUG failed.\n");
return;
}
- logInfo.applicationDebugEnabled = retString.Equals(strYes);
- retString.Clear();
+ retVal = strcmp(strYes, pVal);
+ logInfo.applicationDebugEnabled = (retVal == 0);
- r = reg.GetValue(sectApp, entryException, retString);
- if (IsFailed(r))
+ sprintf(keyString, "%s:%s", sectApp, entryException);
+ keyString[LOG_MODULE_NAME_LEN_MAX*2-1] = '\0';
+ pVal = iniparser_getstr(pDic, keyString);
+ if (pVal == NULL)
{
ALOG(LOG_ERROR, LOG_TAG, "[EXCEPTION] finding Application/EXCEPTION failed.\n");
return;
}
- logInfo.applicationExceptionEnabled = retString.Equals(strYes);
- retString.Clear();
+ retVal = strcmp(strYes, pVal);
+ logInfo.applicationExceptionEnabled = (retVal == 0);
- r = reg.GetValue(sectPlatform, entryInfo, retString);
- if (IsFailed(r))
+ sprintf(keyString, "%s:%s", sectPlatform, entryInfo);
+ keyString[LOG_MODULE_NAME_LEN_MAX*2-1] = '\0';
+ pVal = iniparser_getstr(pDic, keyString);
+ if (pVal == NULL)
{
ALOG(LOG_ERROR, LOG_TAG, "[EXCEPTION] finding Platform/INFO failed.\n");
return;
}
- logInfo.platformInfoEnabled = retString.Equals(strYes);
- retString.Clear();
+ retVal = strcmp(strYes, pVal);
+ logInfo.platformInfoEnabled = (retVal == 0);
- r = reg.GetValue(sectPlatform, entryException, retString);
- if (IsFailed(r))
+ sprintf(keyString, "%s:%s", sectPlatform, entryException);
+ keyString[LOG_MODULE_NAME_LEN_MAX*2-1] = '\0';
+ pVal = iniparser_getstr(pDic, keyString);
+ if (pVal == NULL)
{
ALOG(LOG_ERROR, LOG_TAG, "[EXCEPTION] finding Platform/EXCEPTION failed.\n");
return;
}
- logInfo.platformExceptionEnabled = retString.Equals(strYes);
- retString.Clear();
+ retVal = strcmp(strYes, pVal);
+ logInfo.platformExceptionEnabled = (retVal == 0);
}
void
-__InitializePlatformModule(const Registry& reg)
+__InitializePlatformModule(dictionary *pDic)
{
- const String strYes(L"YES");
- String retString;
+ char sectModule[]="PlatformModules";
+ char strYes[]="YES";
- const String sectModule(L"PlatformModules");
+ char *pVal;
+ int retVal;
- result r;
+ char keyString[LOG_MODULE_NAME_LEN_MAX*2];
for (int i = 0; i < NID_MAX; i++)
{
- String strEntry(logInfo.logTable[i].logIDName);
- r = reg.GetValue(sectModule, strEntry, retString);
- if (IsFailed(r))
+
+ sprintf(keyString, "%s:%s", sectModule, logInfo.logTable[i].logIDName);
+ keyString[LOG_MODULE_NAME_LEN_MAX*2-1] = '\0';
+ pVal = iniparser_getstr(pDic, keyString);
+ if (pVal == NULL)
{
- ALOG(LOG_ERROR, LOG_TAG, "[EXCEPTION] finding PlatformModules/%ls failed.\n", strEntry.GetPointer());
+ ALOG(LOG_ERROR, LOG_TAG, "[EXCEPTION] finding PlatformModules/%ls failed.\n", logInfo.logTable[i].logIDName);
}
else
{
- logInfo.logTable[i].loggingEnabled = retString.Equals(strYes);
+ retVal = strcmp(strYes, pVal);
+ logInfo.logTable[i].loggingEnabled = (retVal == 0);
}
-
- strEntry.Clear();
- retString.Clear();
}
}