base
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
/***************************************************************************
|
||||
LoggerTest.cpp
|
||||
-----------------------------------------
|
||||
begin : 2011/10/27
|
||||
copyright : (C) 2005 SolutionBox Inc.
|
||||
author : Service 1 Team
|
||||
email : svc1@solbox.com
|
||||
version : 1.0
|
||||
|
||||
CopyRight(C) 2005 SolutionBox Inc. All Rights reserved.
|
||||
Redistribution and use in source and binary forms, with or with out
|
||||
modification, are not permitted in outside of SolutionBox Inc.
|
||||
***************************************************************************/
|
||||
#include "LoggerTest.h"
|
||||
#include "Logger.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
CLoggerTest::CLoggerTest()
|
||||
{
|
||||
}
|
||||
|
||||
CLoggerTest::~CLoggerTest()
|
||||
{
|
||||
}
|
||||
|
||||
void CLoggerTest::Run()
|
||||
{
|
||||
cout << "begin CLoggerTest::Run()." << endl;
|
||||
|
||||
if( TestLoggerInit() == false )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TestLogging();
|
||||
|
||||
CLogger::Exit();
|
||||
|
||||
cout << "end CLoggerTest::Run()." << endl;
|
||||
}
|
||||
|
||||
bool CLoggerTest::TestLoggerInit()
|
||||
{
|
||||
if( CLogger::Init( "test_util", "/user/service/logs", LDEV1 ) == false )
|
||||
{
|
||||
cout << "CLogger::Init( test_util, /user/service/log, LDEV1 ) failed." << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CLoggerTest::TestLogging()
|
||||
{
|
||||
FUNC_BEGIN();
|
||||
|
||||
LOG( LEMR, "log level emergency" );
|
||||
LOG( LALT, "log level alert" );
|
||||
LOG( LCRT, "log level critical" );
|
||||
LOG( LERR, "log level error" );
|
||||
LOG( LWAR, "log level warning" );
|
||||
LOG( LNOT, "log level notice" );
|
||||
LOG( LINF, "log level info" );
|
||||
LOG( LDBG, "log level debug" );
|
||||
LOG( LDEV, "log level dev" );
|
||||
LOG( LDEV1, "log level dev1" );
|
||||
|
||||
_LOG_( LEMR, "-------------------------------------------------------------" );
|
||||
|
||||
_LOG( LEMR, "log level emergency" );
|
||||
_LOG( LALT, "log level alert" );
|
||||
_LOG( LCRT, "log level critical" );
|
||||
_LOG( LERR, "log level error" );
|
||||
_LOG( LWAR, "log level warning" );
|
||||
_LOG( LNOT, "log level notice" );
|
||||
_LOG( LINF, "log level info" );
|
||||
_LOG( LDBG, "log level debug" );
|
||||
_LOG( LDEV, "log level dev" );
|
||||
_LOG( LDEV1, "log level dev1" );
|
||||
|
||||
_LOG_( LEMR, "-------------------------------------------------------------" );
|
||||
|
||||
_LOG_( LEMR, "log level emergency" );
|
||||
_LOG_( LALT, "log level alert" );
|
||||
_LOG_( LCRT, "log level critical" );
|
||||
_LOG_( LERR, "log level error" );
|
||||
_LOG_( LWAR, "log level warning" );
|
||||
_LOG_( LNOT, "log level notice" );
|
||||
_LOG_( LINF, "log level info" );
|
||||
_LOG_( LDBG, "log level debug" );
|
||||
_LOG_( LDEV, "log level dev" );
|
||||
_LOG_( LDEV1, "log level dev1" );
|
||||
|
||||
_LOG_( LEMR, "-------------------------------------------------------------" );
|
||||
|
||||
unsigned char hexData[48] =
|
||||
{
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F
|
||||
};
|
||||
|
||||
_LOG_HEX_( LDBG, hexData, 48 );
|
||||
|
||||
FUNC_END();
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/***************************************************************************
|
||||
LoggerTest.h
|
||||
-----------------------------------------
|
||||
begin : 2011/10/27
|
||||
copyright : (C) 2005 SolutionBox Inc.
|
||||
author : Service 1 Team
|
||||
email : svc1@solbox.com
|
||||
version : 1.0
|
||||
|
||||
CopyRight(C) 2005 SolutionBox Inc. All Rights reserved.
|
||||
Redistribution and use in source and binary forms, with or with out
|
||||
modification, are not permitted in outside of SolutionBox Inc.
|
||||
***************************************************************************/
|
||||
#ifndef __LOGGERTEST_H__
|
||||
#define __LOGGERTEST_H__
|
||||
|
||||
class CLoggerTest
|
||||
{
|
||||
// Attributes
|
||||
private:
|
||||
|
||||
protected:
|
||||
|
||||
public:
|
||||
|
||||
|
||||
// Operations
|
||||
private:
|
||||
bool TestLoggerInit();
|
||||
void TestLogging();
|
||||
|
||||
protected:
|
||||
|
||||
public:
|
||||
CLoggerTest();
|
||||
virtual ~CLoggerTest();
|
||||
|
||||
void Run();
|
||||
};
|
||||
|
||||
#endif // __LOGGERTEST_H__
|
||||
@@ -0,0 +1,88 @@
|
||||
#****************************************************************************
|
||||
# Makefile for rc_rmcd
|
||||
# -----------------------------------------
|
||||
#
|
||||
# begin : 2010/03/09
|
||||
# copyright : (C) 2005 SolutionBox Inc.
|
||||
# author : Service 1 Team
|
||||
# email : svc1@solbox.com
|
||||
# version : 1.0
|
||||
#
|
||||
# CopyRight(C) 2005 SolutionBox Inc. All Rights reserved.
|
||||
# Redistribution and use in source and binary forms, with or with out
|
||||
# modification, are not permitted in outside of SolutionBox Inc.
|
||||
#*****************************************************************************
|
||||
|
||||
|
||||
# Program info
|
||||
PROG_NAME = test_util
|
||||
REVISION = 655
|
||||
PROG_VERSION = 3.0.0.$(REVISION)_T-`date +%Y%m%d%H%M%S`
|
||||
|
||||
# Compiler info
|
||||
CC = /usr/bin/g++
|
||||
|
||||
CFLAGS = -Wall -O3 -g -Wimplicit -Wreturn-type -Wunused -Wuninitialized\
|
||||
-Wparentheses -Wshadow -Wpointer-arith -Woverloaded-virtual\
|
||||
-D_REENTRANT
|
||||
|
||||
LFLAGS =
|
||||
|
||||
# DEBUG or RELEASE Mode select
|
||||
#DFLAGS = -D_DEBUG_ -DPROG_NAME=\"$(PROG_NAME)\" -DPROG_VERSION=\"$(PROG_VERSION)\"
|
||||
DFLAGS = -DPROG_NAME=\"$(PROG_NAME)\" -DPROG_VERSION=\"$(PROG_VERSION)\"
|
||||
|
||||
|
||||
# Application Enviroment
|
||||
APP = $(PROG_NAME)
|
||||
|
||||
DIR_INCLUDE = -I. -I.. \
|
||||
-I/usr/local/include \
|
||||
-I/user/db/pgsql/include \
|
||||
|
||||
DIR_LIB = -L. \
|
||||
-L../lib \
|
||||
-L/usr/local/lib
|
||||
|
||||
LIBS = -lcppunit \
|
||||
-lcrypt \
|
||||
-lpthread
|
||||
|
||||
OBJ = main.o \
|
||||
LoggerTest.o ../Logger.o \
|
||||
|
||||
############################
|
||||
|
||||
#ROOT_DIR = /root/src_svn/work/mytest/cmctl/src
|
||||
#DIRS = $(ROOT_DIR)/Framework $(ROOT_DIR)/DataObject $(ROOT_DIR)/Database $(ROOT_DIR)/Cmctl
|
||||
|
||||
all: MAKE_LIBS $(APP)
|
||||
sync
|
||||
|
||||
%.o: %.cpp
|
||||
$(CC) $(CFLAGS) -o $@ -c $^ $(DFLAGS) $(DIR_INCLUDE)
|
||||
|
||||
|
||||
$(PROG_NAME): $(OBJ)
|
||||
$(CC) $(LFLAGS) -o $@ $^ $(OBJS) $(DFLAGS) $(DIR_LIB) $(LIBS)
|
||||
|
||||
|
||||
clean:
|
||||
-rm -f *.o core *.out *.log
|
||||
-rm -f $(APP)
|
||||
sync
|
||||
|
||||
MAKE_LIBS:
|
||||
@for dir in $(DIRS); do \
|
||||
gmake -C $$dir || exit $?; \
|
||||
done
|
||||
-rm -f $(APP)
|
||||
|
||||
|
||||
# cd ../Framework; gmake; cp ../Framework/*.a ../../lib
|
||||
# cd ../DataObject; gmake; cp ../DataObject/*.a ../../lib
|
||||
# cd ../Database; gmake; cp ../Database/*.a ../../lib
|
||||
# cd ../Cmctl; gmake; cp ../Cmctl/*.a ../../lib
|
||||
|
||||
|
||||
# End of Makefile
|
||||
@@ -0,0 +1,15 @@
|
||||
#include "LoggerTest.h"
|
||||
#include "Logger.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
/// CLogger 테스트 시작.
|
||||
CLoggerTest loggerTest;
|
||||
loggerTest.Run();
|
||||
/// CLogger 테스트 끝.
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user