OLD | NEW |
1 | |
2 /* | 1 /* |
3 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
4 * | 3 * |
5 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
7 */ | 6 */ |
8 | 7 |
9 #ifndef SkBenchLogger_DEFINED | 8 #ifndef BenchLogger_DEFINED |
10 #define SkBenchLogger_DEFINED | 9 #define BenchLogger_DEFINED |
11 | 10 |
| 11 #include <stdio.h> |
| 12 #include "SkString.h" |
12 #include "SkTypes.h" | 13 #include "SkTypes.h" |
13 #include "SkString.h" | |
14 #include <stdio.h> | |
15 | 14 |
16 class SkFILEWStream; | 15 class SkFILEWStream; |
17 | 16 |
18 /** | 17 /** |
19 * Class that allows logging to a file while simultaneously logging to stdout/st
derr. | 18 * Class that allows logging to a file while simultaneously logging to stdout/st
derr. |
20 */ | 19 */ |
21 class SkBenchLogger { | 20 class BenchLogger { |
22 public: | 21 public: |
23 SkBenchLogger(); | 22 BenchLogger(); |
24 | 23 |
25 /** | 24 /** |
26 * Not virtual, since this class is not intended to be subclassed. | 25 * Not virtual, since this class is not intended to be subclassed. |
27 */ | 26 */ |
28 ~SkBenchLogger(); | 27 ~BenchLogger(); |
29 | 28 |
30 /** | 29 /** |
31 * Specify a file to write progress logs to. Unless this is called with a va
lid file path, | 30 * Specify a file to write progress logs to. Unless this is called with a va
lid file path, |
32 * SkBenchLogger will only write to stdout/stderr. | 31 * BenchLogger will only write to stdout/stderr. |
33 */ | 32 */ |
34 bool SetLogFile(const char file[]); | 33 bool SetLogFile(const char file[]); |
35 | 34 |
36 /** | 35 /** |
37 * Log an error to stderr, taking a C style string as input. | 36 * Log an error to stderr, taking a C style string as input. |
38 */ | 37 */ |
39 void logError(const char msg[]) { this->nativeLogError(msg); } | 38 void logError(const char msg[]) { this->nativeLogError(msg); } |
40 | 39 |
41 /** | 40 /** |
42 * Log an error to stderr, taking an SkString as input. | 41 * Log an error to stderr, taking an SkString as input. |
(...skipping 24 matching lines...) Expand all Loading... |
67 #else | 66 #else |
68 void nativeLogError(const char msg[]) { fprintf(stderr, "%s", msg); } | 67 void nativeLogError(const char msg[]) { fprintf(stderr, "%s", msg); } |
69 #endif | 68 #endif |
70 void nativeLogProgress(const char msg[]) { SkDebugf("%s", msg); } | 69 void nativeLogProgress(const char msg[]) { SkDebugf("%s", msg); } |
71 | 70 |
72 void fileWrite(const char msg[], size_t size); | 71 void fileWrite(const char msg[], size_t size); |
73 | 72 |
74 SkFILEWStream* fFileStream; | 73 SkFILEWStream* fFileStream; |
75 }; | 74 }; |
76 | 75 |
77 #endif // SkBenchLogger_DEFINED | 76 #endif // BenchLogger_DEFINED |
OLD | NEW |