File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212- UDP 클라이언트 로거가 추가되었습니다.
1313
1414## 예제
15- ### LoggingDemo
15+
16+ ### 설정 방법
1617- 처음에 Qt 프로젝트 파일(* .pro)에 pri 파일을 추가합니다.
1718```
1819# Define QSLogLib relative path. You can fix this directory
2122# QSLOG_SOURCEPATH = ../../QSLogLib/
2223include(../../QSLogLib/QSLogLib.pri)
2324```
24- - Code of main.cpp
25+
26+ ### 표준 출력/파일 로깅 예제
2527``` cpp
2628#include < QtGlobal>
2729#include < QCoreApplication>
@@ -59,6 +61,29 @@ int main(int argc, char *argv[])
5961 // return a.exec();
6062}
6163```
64+
65+ ### UDP 송신 예제
66+ ```cpp
67+ int main()
68+ {
69+ // Add these lines at the beginning of your program.
70+ // The devices and formatters are automatically deleted by SLogLib.
71+ using namespace SLogLib;
72+
73+ std::string strDestAddress = "192.168.137.1";
74+ unsigned short destPort = 5000;
75+ addLoggingDevice(new UdpLogger(strDestAddress, destPort, new NullFormatter));
76+
77+ // The following line writes the message to both console and file.
78+ int a = 10;
79+ double b = 15.3;
80+ const char* c = "Success";
81+ SLOGLIB_LOG_MSG_INFO("a = " << a << " b = " << b);
82+ SLOGLIB_LOG_MSG_INFO(c);
83+
84+ return 0;
85+ }
86+
6287## 테스트 환경
6388- Qt 5.10.1 (MingW, Windows 32bit)
6489- Qt 5.6.2 (Linux 64bit)
Original file line number Diff line number Diff line change 1212- UDP client logger has been added.
1313
1414## Example
15- ### LoggingDemo
15+
16+ ### How to setup
1617- First, include pri file on youq Qt project file(* .pro).
1718```
1819# Define QSLogLib relative path. You can fix this directory
2122# QSLOG_SOURCEPATH = ../../QSLogLib/
2223include(../../QSLogLib/QSLogLib.pri)
2324```
24- - Code of main.cpp
25+
26+ ### Example for standard output and file
2527``` cpp
2628#include < QtGlobal>
2729#include < QCoreApplication>
@@ -60,6 +62,29 @@ int main(int argc, char *argv[])
6062}
6163```
6264
65+ ### Example for udp transmission
66+ ```cpp
67+ int main()
68+ {
69+ // Add these lines at the beginning of your program.
70+ // The devices and formatters are automatically deleted by SLogLib.
71+ using namespace SLogLib;
72+
73+ std::string strDestAddress = "192.168.137.1";
74+ unsigned short destPort = 5000;
75+ addLoggingDevice(new UdpLogger(strDestAddress, destPort, new NullFormatter));
76+
77+ // The following line writes the message to both console and file.
78+ int a = 10;
79+ double b = 15.3;
80+ const char* c = "Success";
81+ SLOGLIB_LOG_MSG_INFO("a = " << a << " b = " << b);
82+ SLOGLIB_LOG_MSG_INFO(c);
83+
84+ return 0;
85+ }
86+ ```
87+
6388## Test Environment
6489- Qt 5.10.1 (MingW, Windows 32bit)
6590- Qt 5.6.2 (Linux 64bit)
You can’t perform that action at this time.
0 commit comments