My favorites
▼
|
Sign in
rxwen-blog-stuff
my blog stuff
Project Home
Downloads
Wiki
Issues
Source
Checkout
Browse
Changes
Source path:
svn
/
trunk
/
protocol
/
osip_logging
/
osip_log.cpp
‹r59
r314
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#define ENABLE_TRACE
#include "osip2/osip.h"
#include <stdio.h>
void printf_trace_func (char *fi, int li, osip_trace_level_t level, char *chfr, va_list ap)
{
const char* desc = " ";
switch(level)
{
case OSIP_FATAL:
desc = " FATAL ";
break;
case OSIP_BUG:
desc = " BUG ";
break;
case OSIP_ERROR:
desc = " ERROR ";
break;
case OSIP_WARNING:
desc = "WARNING";
break;
case OSIP_INFO1:
desc = " INFO1 ";
break;
case OSIP_INFO2:
desc = " INFO2 ";
break;
case OSIP_INFO3:
desc = " INFO3 ";
break;
case OSIP_INFO4:
desc = " INFO4 ";
break;
default:
desc = " ";
}
printf ("|%s| <%s: %i> | ", desc, fi, li);
vprintf(chfr, ap);
printf ("\n");
}
int main(int argc, _TCHAR* argv[])
{
// use plain file as logging storage
// FILE* f = fopen("c:\\1.txt", "w");
// TRACE_INITIALIZE(END_TRACE_LEVEL, f);
// use custom function
osip_trace_initialize_func(END_TRACE_LEVEL, &printf_trace_func);
// write log message
OSIP_TRACE (osip_trace(__FILE__, __LINE__, static_cast<osip_trace_level_t>(OSIP_INFO1), NULL, "osip_trace module initialized!"));
// trun log message of OSIP_INFO1 level off
TRACE_DISABLE_LEVEL(OSIP_INFO1);
OSIP_TRACE (osip_trace(__FILE__, __LINE__, static_cast<osip_trace_level_t>(OSIP_INFO1), NULL, "osip_trace module initialized!"));
return 0;
}
Show details
Hide details
Change log
r60
by rx.wen218 on May 21, 2010
Diff
fix bug: use vprintf to print va_list
Go to:
...otocol/osip_logging/osip_log.cpp
Project members,
sign in
to write a code review
Older revisions
r59
by rx.wen218 on May 20, 2010
Diff
add osip logging sample
All revisions of this file
File info
Size: 1519 bytes, 61 lines
View raw file
Powered by
Google Project Hosting