1. First, you must use the log class file include "flogger. H", and then add the flogger. Lib file.
The header files and library files corresponding to rfilelogger are flogger. h and flogger. Lib.
Ii. Use
1. Add the upper and lower code to constructl () in the second stage of the class:
// Open the log file service connection
Rfilelogger ilog;
Ilog. Connect ();
Ilog. createlog (_ L ("myloggingdirectory"), _ L ("mylogfile"), efileloggingmodeoverwrite );
The createlog function has three parameters: Log Path Log File Name Record mode (efileloggingmodeoverwrite | efileloggingmodeappend)
The above code is the full path of my log file (File System on the mobile phone) C:/logs/myloggingdirectory/mylogfile.
2. Add the following code to the class destructor:
// Close the connection between the log file and the server
Ilog. closelog ();
Ilog. Close ();
3. Input text and data to the log file
Command Log File
Ilog. Write (_ L ("Hello World") fig 4:00:13 Hello World
Ilog. writeformat (_ L ("result = % d"), err) 11/07/2003 4:00:13 result = 0
Ilog. hexdump (aheader, aheader, myptr, 4) 11/07/2003 4:00:13 mybuf: 0000: 41 42 00 44 AB. d
(After completing the preceding steps, an error may be reported, prompting that the ilog cannot be defined. I wrote the rfilelogger ilog statement *. *. in the H file, then compile it)
If you do not want to record dates and events, you can use this function to close them:
Ilog. setdateandtime (tbool ausedate, tbool ausetime)
3. Note:
1. The above is a slight change to the content written by others on the Internet.
2. When debugging on the simulator (that is, the log file is created on the computer ):
In this case, the log file directory should be: C:/Symbian/7.0 S/series60_v21/epoc32/wins/C/logs
The above code is actually to create a folder named myloggingdirectory in this directory, and create a log file mylogfile without an extension.
Note: The folder myloggingdirectory must be manually created by us, but the mylogfile program of the log file will be created for us. If this folder is not created, the log file will not be created, but the program will not report an error at this time, but the debugging information will not be obtained.
3. When debugging on the mobile phone (that is, the log file is created on the mobile phone)