1 /**
2  * FreeRDP: A Remote Desktop Protocol Implementation
3  * FreeRDP Proxy Server
4  *
5  * Copyright 2019 Mati Shabtay <matishabtay@gmail.com>
6  * Copyright 2019 Kobi Mizrachi <kmizrachi18@gmail.com>
7  * Copyright 2019 Idan Freiberg <speidy@gmail.com>
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *     http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21 
22 #ifndef FREERDP_SERVER_PROXY_PFLOG_H
23 #define FREERDP_SERVER_PROXY_PFLOG_H
24 
25 #include <winpr/wlog.h>
26 
27 #define PROXY_TAG(tag) "proxy." tag
28 
29 /*
30  * log format in proxy is:
31  * "[SessionID=%s] - [__FUNCTION__]: Log message"
32  * both SessionID and __FUNCTION__ are optional, but if they should be written to the log,
33  * that's the format.
34  */
35 
36 /* log macros that prepends session id and function name tp the log message */
37 #define LOG_INFO(_tag, _context, _format, ...)                                                \
38 	WLog_INFO(TAG, "[SessionID=%s][%s]: " _format, _context->pdata->session_id, __FUNCTION__, \
39 	          ##__VA_ARGS__)
40 #define LOG_ERR(_tag, _context, _format, ...)                                                \
41 	WLog_ERR(TAG, "[SessionID=%s][%s]: " _format, _context->pdata->session_id, __FUNCTION__, \
42 	         ##__VA_ARGS__)
43 #define LOG_DBG(_tag, _context, _format, ...)                                                \
44 	WLog_DBG(TAG, "[SessionID=%s][%s]: " _format, _context->pdata->session_id, __FUNCTION__, \
45 	         ##__VA_ARGS__)
46 #define LOG_WARN(_tag, _context, _format, ...)                                                \
47 	WLog_WARN(TAG, "[SessionID=%s][%s]: " _format, _context->pdata->session_id, __FUNCTION__, \
48 	          ##__VA_ARGS__)
49 
50 #endif /* FREERDP_SERVER_PROXY_PFLOG_H */