toast-logncrash-androidndk-sdk
Public Member Functions | List of all members
ToastLog Class Reference

Public Member Functions

int initialize (const char *appKey, const char *version=LOGNCRASH_VERSION, const char *collectorAddr=LOGNCRASH_COLLECTOR_ADDR, const uint16_t collectorPort=LOGNCRASH_COLLECTOR_PORT, const char *logSource=LOGNCRASH_LOGSOURCE, const char *logType=LOGNCRASH_LOGTYPE boolean clientHost=true, boolean asyncStart=false, char *handlerName=null)
 toast/logncrash.h 를 포함하고 ToastLog class를 사용합니다. ToastLog 기능이 제대로 동작하기 위해서는 반드시 initialize()가 호출되어야 합니다. clinetHost가 true인 경우 ioctl 방식으로 ip address를 구합니다. false인 경우 서버에 전달된 값으로 host 필드를 채웁니다. asyncStart가 true인 경우 SendThread를 Lock 시킨 상태로 시작합니다. SendThread가 Lock인 경우 발생된 로그를 서버로 전송하지 않고 큐에 저장합닙니다. StartSendThread 함수가 호출되거나 Crash가 발생하면 Lock 상태가 해제됩니다. handlerName에 Appguard를 입력한 경우 AppGuard 옵션으로 핸들러가 생성됩니다. More...
 
void startSendThread ()
 startSendThread는 SendThread의 Lock 상태를 해제합니다. More...
 
bool addCustomKey_AppGuard (const char *key, const char *value)
 addCustomKey_AppGuard는 사용자 지정 필드를 추가합니다. key는 필드명, val은 필드값이 됩니다. 이때 필드명의 첫 단어는 a~z 혹은 A~Z로 시작하는 알파벳이어야 하며, 필드명의 경우 공백을 포함할 수 없습니다. More...
 
void removeCustomKey_AppGuard (const char *key)
 removeCustomKey는 사용자가 추가한 특정 필드를 삭제합니다. More...
 
void clearCustomKeys_AppGuard ()
 clearCustomKeys는 사용자가 추가한 전체 필드를 삭제합니다. More...
 
void setUserId_AppGuard (const char *userId)
 setUserId는 UserID 필드를 정의합니다. UserID는 현재 로그를 발생시킨 사용자를 구별하기 위한 필드로, 사용자별 에러 통계를 얻기 위해서는 반드시 정의해야 합니다. More...
 
String getUserId_AppGuard ()
 getUserId는 현재 UserID를 반환합니다. More...
 
void setLogLevel_AppGuard (int logLevel)
 setLogLevel는 현재 logLevel를 설정합니다. 전송할 logLevel은. setLogLevel()로 지정된 logLevel보다 큰 logLevel은 전송이 안됩니다. ( 큰 순서 : Debug, INFO, WARN, ERROR, FATAL , logLevel이 WARN인 경우 WARN, ERROR, FATAL은 전송 가능하지만 INFO, DEBUG 레벨의 로그는 전송하지 못합니다.) More...
 
bool sendLog_AppGuard (const char *level const char *message, const char *errorCode=NULL, const char *location=NULL)
 일반 로그를 서버로 전송합니다. More...
 
void setDeduplicate_AppGuard (const bool enable)
 setDeduplicate_AppGuard는 중복 로그 제거 설정 함수입니다. 중복 로그 제거 기능이란 일반 로그와 핸들드 로그의 경우 message, logType, logLevel 필드을 기준으로 완전히 동일한 로그들이 발생하는 경우, 이를 서버로 전송하지 않는 기능입니다. 크래시 로그의 경우 크래시 내용인 DmpData 필드를 기준으로 중복을 제거합니다. 기본값은 true이며, true인 경우 중복제거 기능이 활성화되며, false인 경우 비활성화됩니다. More...
 
void destroy ()
 객체를 파괴합니다. 공용 객체 입니다. More...
 
void enableHost_Appguard ()
 IP Address 수집 동작 설정 More...
 

Member Function Documentation

§ addCustomKey_AppGuard()

bool ToastLog::addCustomKey_AppGuard ( const char *  key,
const char *  value 
)

addCustomKey_AppGuard는 사용자 지정 필드를 추가합니다. key는 필드명, val은 필드값이 됩니다. 이때 필드명의 첫 단어는 a~z 혹은 A~Z로 시작하는 알파벳이어야 하며, 필드명의 경우 공백을 포함할 수 없습니다.

Returns
bool : 성공 / 실패
Parameters
char*key 사용자 지정 필드 키
char*value 사용자 지정 필드 값
public class AndroidNDKSample extends Activity {
if (LogNCrashJNI.initialize(appKey, version, collectorAddr, collectorPort, logSource, logType, true, true, "AppGuard") == LogNCrashJNI.LOG_OK) {
Toast.makeText(this, "Initialize", Toast.LENGTH_SHORT).show();
mIsInitialied = true;
}
else {
Toast.makeText(this, "Fail to initialize", Toast.LENGTH_SHORT).show();
mIsInitialied = false;
}
LogNCrashJNI.addCustomKey_AppGuard("MyCustomKey", "Some Value");
}

§ clearCustomKeys_AppGuard()

void ToastLog::clearCustomKeys_AppGuard ( )

clearCustomKeys는 사용자가 추가한 전체 필드를 삭제합니다.

Returns
void
public class AndroidNDKSample extends Activity {
if (LogNCrashJNI.initialize(appKey, version, collectorAddr, collectorPort, logSource, logType, true, true, "AppGuard") == LogNCrashJNI.LOG_OK) {
Toast.makeText(this, "Initialize", Toast.LENGTH_SHORT).show();
mIsInitialied = true;
}
else {
Toast.makeText(this, "Fail to initialize", Toast.LENGTH_SHORT).show();
mIsInitialied = false;
}
LogNCrashJNI.addCustomKey_AppGuard("MyCustomKey", "Some Value");
LogNCrashJNI.clearCustomKeys_AppGuard();
}

§ destroy()

void ToastLog::destroy ( )

객체를 파괴합니다. 공용 객체 입니다.

Returns
void
Parameters

§ enableHost_Appguard()

void ToastLog::enableHost_Appguard ( )

IP Address 수집 동작 설정

Returns
void
Parameters
boolIP Address 수집 설정 값. default는 true이며 true인 경우 IP Address 수집, false인 경우 host 필드에 '-'를 삽입한다.
public class AndroidNDKSample extends Activity {
LogNCrashJNI.enableHost_Appguard(false);
if (LogNCrashJNI.initialize(appKey, version, collectorAddr, collectorPort, logSource, logType, true, true, "AppGuard") == LogNCrashJNI.LOG_OK) {
Toast.makeText(this, "Initialize", Toast.LENGTH_SHORT).show();
mIsInitialied = true;
}
else {
Toast.makeText(this, "Fail to initialize", Toast.LENGTH_SHORT).show();
mIsInitialied = false;
}
}

§ getUserId_AppGuard()

String ToastLog::getUserId_AppGuard ( )

getUserId는 현재 UserID를 반환합니다.

Returns
String
public class AndroidNDKSample extends Activity {
if (LogNCrashJNI.initialize(appKey, version, collectorAddr, collectorPort, logSource, logType, true, true, "AppGuard") == LogNCrashJNI.LOG_OK) {
Toast.makeText(this, "Initialize", Toast.LENGTH_SHORT).show();
mIsInitialied = true;
}
else {
Toast.makeText(this, "Fail to initialize", Toast.LENGTH_SHORT).show();
mIsInitialied = false;
}
LogNCrashJNI.setUserId_AppGuard("TestUser");
String user = LogNCrashJNI.getUserId_AppGuard();
}

§ initialize()

int ToastLog::initialize ( const char *  appKey,
const char *  version = LOGNCRASH_VERSION,
const char *  collectorAddr = LOGNCRASH_COLLECTOR_ADDR,
const uint16_t  collectorPort = LOGNCRASH_COLLECTOR_PORT,
const char *  logSource = LOGNCRASH_LOGSOURCE,
const char *  logType = LOGNCRASH_LOGTYPE boolean clientHost=true,
boolean  asyncStart = false,
char *  handlerName = null 
)

toast/logncrash.h 를 포함하고 ToastLog class를 사용합니다. ToastLog 기능이 제대로 동작하기 위해서는 반드시 initialize()가 호출되어야 합니다. clinetHost가 true인 경우 ioctl 방식으로 ip address를 구합니다. false인 경우 서버에 전달된 값으로 host 필드를 채웁니다. asyncStart가 true인 경우 SendThread를 Lock 시킨 상태로 시작합니다. SendThread가 Lock인 경우 발생된 로그를 서버로 전송하지 않고 큐에 저장합닙니다. StartSendThread 함수가 호출되거나 Crash가 발생하면 Lock 상태가 해제됩니다. handlerName에 Appguard를 입력한 경우 AppGuard 옵션으로 핸들러가 생성됩니다.

Returns
int32_t : 성공 / 실패
Parameters
char*appKey 사용자 프로젝트에 발급된 앱키
char*version 로그 버전 정보
char*collectorAddr 콜렉터 주소
uint16_tcollectorPort 콜렉터 포트 ( http 80, https 443 )
char*logSource 로그 소스 ( 사용자 지정 )
char*logType 로그 타입 ( 사용자 지정 )
booleanclientHost ClientIP 구하는 방식 ( 사용자 지정 )
booleanasyncStart SendThread Lock 옵션 ( 사용자 지정 )
char*handlerName AppGuard용 초기화를 위한 핸들러 이름 ( 사용자 지정 )
public class AndroidNDKSample extends Activity {
if (LogNCrashJNI.initialize(appKey, version, collectorAddr, collectorPort, logSource, logType) == LogNCrashJNI.LOG_OK) {
Toast.makeText(this, "Initialize", Toast.LENGTH_SHORT).show();
mIsInitialied = true;
}
else {
Toast.makeText(this, "Fail to initialize", Toast.LENGTH_SHORT).show();
mIsInitialied = false;
}
}

§ removeCustomKey_AppGuard()

void ToastLog::removeCustomKey_AppGuard ( const char *  key)

removeCustomKey는 사용자가 추가한 특정 필드를 삭제합니다.

Returns
void
Parameters
char*key 삭제할 필드 키
public class AndroidNDKSample extends Activity {
if (LogNCrashJNI.initialize(appKey, version, collectorAddr, collectorPort, logSource, logType, true, true, "AppGuard") == LogNCrashJNI.LOG_OK) {
Toast.makeText(this, "Initialize", Toast.LENGTH_SHORT).show();
mIsInitialied = true;
}
else {
Toast.makeText(this, "Fail to initialize", Toast.LENGTH_SHORT).show();
mIsInitialied = false;
}
LogNCrashJNI.addCustomKey_AppGuard("MyCustomKey", "Some Value");
LogNCrashJNI.removeCustomKey_AppGuard("MyCustomKey");
}

§ sendLog_AppGuard()

bool ToastLog::sendLog_AppGuard ( const char *level const char *  message,
const char *  errorCode = NULL,
const char *  location = NULL 
)

일반 로그를 서버로 전송합니다.

Returns
bool : 성공 / 실패
Parameters
char*level 로그 레벨
char*message 전송 메세지
char*errorCode 에러 코드
char*location 에러 위치
public class AndroidNDKSample extends Activity {
LogNCrashJNI.setDeduplicate_AppGuard(false);
if (LogNCrashJNI.initialize(appKey, version, collectorAddr, collectorPort, logSource, logType, true, true, "AppGuard") == LogNCrashJNI.LOG_OK) {
Toast.makeText(this, "Initialize", Toast.LENGTH_SHORT).show();
mIsInitialied = true;
}
else {
Toast.makeText(this, "Fail to initialize", Toast.LENGTH_SHORT).show();
mIsInitialied = false;
}
String message = "Hello, World"
String errorCode = "errorCode";
String location = "errorLocation";
if (LogNCrashJNI.sendLog_AppGuard(LogNCrashJNI.INFO, message, errorCode, location)) {
Toast.makeText(this, "Success", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, "Fail to sendLog(ERROR)", Toast.LENGTH_SHORT).show();
}
}

§ setDeduplicate_AppGuard()

void ToastLog::setDeduplicate_AppGuard ( const bool  enable)

setDeduplicate_AppGuard는 중복 로그 제거 설정 함수입니다. 중복 로그 제거 기능이란 일반 로그와 핸들드 로그의 경우 message, logType, logLevel 필드을 기준으로 완전히 동일한 로그들이 발생하는 경우, 이를 서버로 전송하지 않는 기능입니다. 크래시 로그의 경우 크래시 내용인 DmpData 필드를 기준으로 중복을 제거합니다. 기본값은 true이며, true인 경우 중복제거 기능이 활성화되며, false인 경우 비활성화됩니다.

Returns
void
Parameters
boolenable 종복 제거 활성화/비활성화
public class AndroidNDKSample extends Activity {
LogNCrashJNI.setDeduplicate(false);
if (LogNCrashJNI.initialize(appKey, version, collectorAddr, collectorPort, logSource, logType, true, true, "AppGuard") == LogNCrashJNI.LOG_OK) {
Toast.makeText(this, "Initialize", Toast.LENGTH_SHORT).show();
mIsInitialied = true;
}
else {
Toast.makeText(this, "Fail to initialize", Toast.LENGTH_SHORT).show();
mIsInitialied = false;
}
}

§ setLogLevel_AppGuard()

void ToastLog::setLogLevel_AppGuard ( int  logLevel)

setLogLevel는 현재 logLevel를 설정합니다. 전송할 logLevel은. setLogLevel()로 지정된 logLevel보다 큰 logLevel은 전송이 안됩니다. ( 큰 순서 : Debug, INFO, WARN, ERROR, FATAL , logLevel이 WARN인 경우 WARN, ERROR, FATAL은 전송 가능하지만 INFO, DEBUG 레벨의 로그는 전송하지 못합니다.)

Returns
void
Parameters
LogNCrashLogLevellogLevel 로그 레벨
public class AndroidNDKSample extends Activity {
LogNCrashJNI.setLogLevel_AppGuard(LogNCrashJNI.DEBUG);
if (LogNCrashJNI.initialize(appKey, version, collectorAddr, collectorPort, logSource, logType, true, true, "AppGuard") == LogNCrashJNI.LOG_OK) {
Toast.makeText(this, "Initialize", Toast.LENGTH_SHORT).show();
mIsInitialied = true;
}
else {
Toast.makeText(this, "Fail to initialize", Toast.LENGTH_SHORT).show();
mIsInitialied = false;
}
}

§ setUserId_AppGuard()

void ToastLog::setUserId_AppGuard ( const char *  userId)

setUserId는 UserID 필드를 정의합니다. UserID는 현재 로그를 발생시킨 사용자를 구별하기 위한 필드로, 사용자별 에러 통계를 얻기 위해서는 반드시 정의해야 합니다.

Returns
void
Parameters
char*userId 사용자 아이디
public class AndroidNDKSample extends Activity {
if (LogNCrashJNI.initialize(appKey, version, collectorAddr, collectorPort, logSource, logType, true, true, "AppGuard") == LogNCrashJNI.LOG_OK) {
Toast.makeText(this, "Initialize", Toast.LENGTH_SHORT).show();
mIsInitialied = true;
}
else {
Toast.makeText(this, "Fail to initialize", Toast.LENGTH_SHORT).show();
mIsInitialied = false;
}
LogNCrashJNI.setUserId_AppGuard("TestUser");
}

§ startSendThread()

void ToastLog::startSendThread ( )

startSendThread는 SendThread의 Lock 상태를 해제합니다.

Returns
void
public class AndroidNDKSample extends Activity {
if (LogNCrashJNI.initialize(appKey, version, collectorAddr, collectorPort, logSource, logType, true, true, "AppGuard") == LogNCrashJNI.LOG_OK) {
Toast.makeText(this, "Initialize", Toast.LENGTH_SHORT).show();
mIsInitialied = true;
}
else {
Toast.makeText(this, "Fail to initialize", Toast.LENGTH_SHORT).show();
mIsInitialied = false;
}
LogNCrashJNI.startSendThread();
}

The documentation for this class was generated from the following file: