Stun Server  Compliant with the latest RFCs including 5389, 5769, and 5780
discover the local host's own external IP address
logger.cpp
Go to the documentation of this file.
1 /*
2  Copyright 2011 John Selbie
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 */
16 
17 
18 #include "commonincludes.hpp"
19 
20 #include "logger.h"
21 
22 
23 namespace Logging
24 {
25  static uint32_t s_loglevel = LL_ALWAYS; // error and usage messages only
26 
27  void VPrintMsg(const char* pszFormat, va_list& args)
28  {
29  ::vprintf(pszFormat, args);
30  ::printf("\n");
31  }
32 
33  uint32_t GetLogLevel()
34  {
35  return s_loglevel;
36  }
37 
38  void SetLogLevel(uint32_t level)
39  {
40  s_loglevel = level;
41  }
42 
43 
44  void LogMsg(uint32_t level, const char* pszFormat, ...)
45  {
46  va_list args;
47  va_start(args, pszFormat);
48 
49  if (level <= s_loglevel)
50  {
51  VPrintMsg(pszFormat, args);
52  }
53 
54  va_end(args);
55  }
56 }
void LogMsg(uint32_t level, const char *pszFormat,...)
Definition: logger.cpp:44
void VPrintMsg(const char *pszFormat, va_list &args)
Definition: logger.cpp:27
void SetLogLevel(uint32_t level)
Definition: logger.cpp:38
static uint32_t s_loglevel
Definition: logger.cpp:25
uint32_t GetLogLevel()
Definition: logger.cpp:33
const uint32_t LL_ALWAYS
Definition: logger.h:23