When debugging a mobile phone program, we often need to write logs to obtain information during the running process. The following describes how to write logs:
Method 1: rfilelogger
// Open the log file service connection
Rfilelogger ilog;
Ilog. Connect ();
Ilog. createlog (_ L ("myloggingdirectory"), _ L ("mylogfile"), efileloggingmodeoverwrite );
//...
// Close the connection between the log file and the server
Ilog. closelog ();
Ilog. Close ();
Method 2: write files by yourself
RFS & FS = icoeenv-> fssession ();
# Ifdef _ debug
_ Partition (kfilename, "C: // helloworld.txt ");
# Else
_ Partition (kfilename, "d: // helloworld.txt ");
# Endif
Tuint mode = efilewrite + efilestreamtext + efile1_any;
User: leaveiferror (ifile. Replace (FS, kfilename, mode ));
Ifile. writeuint16l (0 xfeff); // windows Unicode file header.
_ Partition (khelloworld, "helloworld ");
Ifile. writel (khelloworld );