DetectorGraph  2.0
dglogging.cpp
Go to the documentation of this file.
1 // Copyright 2017 Nest Labs, Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include <dglogging.hpp>
16 
17 #include <cstdio>
18 #include <cstdarg>
19 
20 #define LINE_BUFFER_SIZE 512
21 
22 void DG_LOG(const char* aLogString, ...)
23 {
24  char buff[LINE_BUFFER_SIZE];
25  va_list args;
26  va_start(args, aLogString);
27  // vsnprintf only exists in c++11; without "n" this is a security problem
28  // but I don't care since this is just test code.
29  vsprintf(buff, aLogString, args);
30  va_end(args);
31 
32  printf("DetectorGraph: %s\n", buff);
33 }
void DG_LOG(const char *aLogString,...)
Definition: dglogging.cpp:22
#define LINE_BUFFER_SIZE
Definition: dglogging.cpp:20