OpenZGY/C++ API and Internals (ALPHA)
Access seismic data stored in ZGY format.
logger.h
Go to the documentation of this file.
1 // Copyright 2017-2020, Schlumberger
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 #pragma once
16 
17 #include "../declspec.h"
18 
19 #include <string>
20 #include <sstream>
21 #include <functional>
22 
23 namespace InternalZGY {
24 #if 0
25 }
26 #endif
27 
76 class OPENZGY_API LoggerBase
77 {
78 public:
79  typedef std::function<bool(int, const std::string&)> LoggerFn;
80  static int getVerboseFromEnv(const char *envname);
81  static bool logger(const LoggerFn& logger, int priority, const std::string& str = std::string());
82  static bool logger(const LoggerFn& logger, int priority, const std::ios& ss);
83  static LoggerFn emptyCallback();
84  static LoggerFn standardCallback(int level, const std::string& prefix, const std::string& suffix);
85 };
86 
87 
93 class OPENZGY_API Logger : public LoggerBase
94 {
95 public:
96  Logger();
97  static Logger* instance();
98  const LoggerFn& getCallback() const;
99  static const LoggerFn& getForwarder();
100  void setCallback(const LoggerFn& callback);
101  void setCallback(int currentlevel);
102 private:
103  LoggerFn callback_;
104 };
105 
106 extern OPENZGY_API bool newlogger(int priority, const std::string& str);
107 extern OPENZGY_API bool newlogger(int priority, const std::ios& ss);
108 
109 } // namespace
InternalZGY::LoggerBase
Definition: logger.h:76
InternalZGY
Implementation not visible to clients.
InternalZGY::Logger
Definition: logger.h:93