| 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 #pragma once
6
7 #include <sstream>
8 #include <string>
9
10 #include "flutter/fml/logging.h"
11 #include "flutter/fml/macros.h"
12
13 namespace impeller {
14 namespace compiler {
15
16 class AutoLogger {
17 public:
18 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 FML_DISALLOW_COPY_AND_ASSIGN(AutoLogger);
35 };
36
37 #define COMPILER_ERROR(stream) \
38 ::impeller::compiler::AutoLogger(stream) << GetSourcePrefix()
39
40 #define COMPILER_ERROR_NO_PREFIX(stream) \
41 ::impeller::compiler::AutoLogger(stream)
42
43 } // namespace compiler
44 } // namespace impeller
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