/src/tesseract/src/ccutil/tprintf.h
Line | Count | Source |
1 | | /********************************************************************** |
2 | | * File: tprintf.h |
3 | | * Description: Trace version of printf - portable between UX and NT |
4 | | * Author: Phil Cheatle |
5 | | * |
6 | | * (C) Copyright 1995, Hewlett-Packard Ltd. |
7 | | ** Licensed under the Apache License, Version 2.0 (the "License"); |
8 | | ** you may not use this file except in compliance with the License. |
9 | | ** You may obtain a copy of the License at |
10 | | ** http://www.apache.org/licenses/LICENSE-2.0 |
11 | | ** Unless required by applicable law or agreed to in writing, software |
12 | | ** distributed under the License is distributed on an "AS IS" BASIS, |
13 | | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
14 | | ** See the License for the specific language governing permissions and |
15 | | ** limitations under the License. |
16 | | * |
17 | | **********************************************************************/ |
18 | | |
19 | | #ifndef TESSERACT_CCUTIL_TPRINTF_H |
20 | | #define TESSERACT_CCUTIL_TPRINTF_H |
21 | | |
22 | | #include "params.h" // for INT_VAR_H |
23 | | #include <tesseract/export.h> // for TESS_API |
24 | | #include <cstdarg> |
25 | | #include <utility> // for std::forward |
26 | | |
27 | | namespace tesseract { |
28 | | |
29 | | // Disable some log messages by setting log_level > 0. |
30 | | extern TESS_API INT_VAR_H(log_level); |
31 | | |
32 | | // Get file for debug output. |
33 | | TESS_API FILE *get_debugfp(); |
34 | | |
35 | | // Main logging function. Trace printf. |
36 | 4.78k | inline void tprintf(const char *format, ...) { |
37 | 4.78k | va_list args; |
38 | 4.78k | va_start(args, format); |
39 | 4.78k | vfprintf(get_debugfp(), format, args); |
40 | | va_end(args); |
41 | 4.78k | } |
42 | | |
43 | | } // namespace tesseract |
44 | | |
45 | | #endif // define TESSERACT_CCUTIL_TPRINTF_H |