| Flutter Impeller |

logger.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef FLUTTER_IMPELLER_COMPILER_LOGGER_H_
6 #define FLUTTER_IMPELLER_COMPILER_LOGGER_H_
7
8 #include <sstream>
9 #include <string>
10
11 #include "flutter/fml/logging.h"
12
13 namespace impeller {
14 namespace compiler {
15
16 class AutoLogger {
17 public:
18 explicit AutoLogger(std::stringstream& logger) : logger_(logger) {}
19
20 ~AutoLogger() {
21 logger_ << std::endl;
22 logger_.flush();
23 }
24
25 template <class T>
26 AutoLogger& operator<<(const T& object) {
27 logger_ << object;
28 return *this;
29 }
30
31 private:
32 std::stringstream& logger_;
33
34 AutoLogger(const AutoLogger&) = delete;
35
36 AutoLogger& operator=(const AutoLogger&) = delete;
37 };
38
39 #define COMPILER_ERROR(stream) \
40 ::impeller::compiler::AutoLogger(stream) << GetSourcePrefix()
41
42 #define COMPILER_ERROR_NO_PREFIX(stream) \
43 ::impeller::compiler::AutoLogger(stream)
44
45 } // namespace compiler
46 } // namespace impeller
47
48 #endif // FLUTTER_IMPELLER_COMPILER_LOGGER_H_
impeller::compiler::AutoLogger::operator<<
AutoLogger & operator<<(const T &object)
Definition: logger.h:26
impeller::compiler::AutoLogger::~AutoLogger
~AutoLogger()
Definition: logger.h:20
impeller::compiler::AutoLogger
Definition: logger.h:16
impeller
Definition: aiks_context.cc:10
impeller::compiler::AutoLogger::AutoLogger
AutoLogger(std::stringstream &logger)
Definition: logger.h:18