Cisco Cisco Computer Telephony Integration Option 8.5 개발자 가이드

다운로드
페이지 668
 
Appendix B      CTI OS Logging
Logging and Tracing (.NET)
B-8
CTI OS Developer’s Guide for Cisco ICM/IPCC Enterprise & Hosted Editions Release 7.1(1)
  •
numberDaysBeforeFileExpired - Maximum number of days before a log file 
is rolled over into a new log file regardless of the size of the file.
The following code snippet creates an instance of the LogWrapper class that 
writes trace events to MyLogFile.txt. When MyLogFile.txt reaches 2048 KB, a 
new log file is created. The Logger creates a maximum of 20 log files in the log 
file directory before overwriting existing files . After 10 days, the log file is rolled 
over into a new log file regardless of its size.
// Create a LogWrapper. This will create a file and start 
// listening for log events to write to the file.
String logFileName                 = "MyLogFile.txt";
int    fileMaxSize                 = 2048;
int    numberArchivesFiles         = 20;
int    numberDaysBeforeFileExpired = 10;
m_logWrapper = new LogWrapper(logFileName, fileMaxSize, 
numberArchivesFiles, numberDaysBeforeFileExpired);
 
Step 2
In your application, write trace events. The following example traces a message 
at the given trace level for the given method. Set the trace level to the desired trace 
mask. Trace masks are defined in the Logger class. See 
 for a list of 
available trace mask values.
protected internal static void MyTrace (
 
int traceLevel,
string methodName,
string msg)
{
if ( m_logger.IsTraceMaskEnabled(traceLevel) )
{
string tracsMsg = string.Format("{0}: {1}", methodName,
msg) ;
m_logger.Trace(traceLevel, msg) ;
}
}
The CTI Toolkit Combo Desktop .NET sample application included with the CTI 
OS toolkit shows how to use the CIL's LogWrapper class in the context of a 
complex softphone application.