|
| 1 | +/* |
| 2 | + * This file is part of the OpenKinect Project. http://www.openkinect.org |
| 3 | + * |
| 4 | + * Copyright (c) 2014 individual OpenKinect contributors. See the CONTRIB file |
| 5 | + * for details. |
| 6 | + * |
| 7 | + * This code is licensed to you under the terms of the Apache License, version |
| 8 | + * 2.0, or, at your option, the terms of the GNU General Public License, |
| 9 | + * version 2.0. See the APACHE20 and GPL2 files for the text of the licenses, |
| 10 | + * or the following URLs: |
| 11 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | + * http://www.gnu.org/licenses/gpl-2.0.txt |
| 13 | + * |
| 14 | + * If you redistribute this file in source form, modified or unmodified, you |
| 15 | + * may: |
| 16 | + * 1) Leave this header intact and distribute it under the same terms, |
| 17 | + * accompanying it with the APACHE20 and GPL20 files, or |
| 18 | + * 2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or |
| 19 | + * 3) Delete the GPL v2 clause and accompany it with the APACHE20 file |
| 20 | + * In all cases you must keep the copyright notice intact and include a copy |
| 21 | + * of the CONTRIB file. |
| 22 | + * |
| 23 | + * Binary distributions must follow the binary distribution requirements of |
| 24 | + * either License. |
| 25 | + */ |
| 26 | + |
| 27 | +#ifndef LIBFREENECT2_LOGGER_H_ |
| 28 | +#define LIBFREENECT2_LOGGER_H_ |
| 29 | + |
| 30 | +#include <string> |
| 31 | +#include <sstream> |
| 32 | + |
| 33 | +#include <libfreenect2/config.h> |
| 34 | + |
| 35 | +namespace libfreenect2 |
| 36 | +{ |
| 37 | + |
| 38 | +class LIBFREENECT2_API Logger |
| 39 | +{ |
| 40 | +public: |
| 41 | + enum Level |
| 42 | + { |
| 43 | + None = 0, |
| 44 | + Error = 1, |
| 45 | + Warning = 2, |
| 46 | + Info = 3, |
| 47 | + Debug = 4, |
| 48 | + }; |
| 49 | + static Level getDefaultLevel(); |
| 50 | + |
| 51 | + virtual ~Logger(); |
| 52 | + |
| 53 | + virtual Level level() const; |
| 54 | + |
| 55 | + virtual void log(Level level, const std::string &message) = 0; |
| 56 | +protected: |
| 57 | + Level level_; |
| 58 | +}; |
| 59 | + |
| 60 | +LIBFREENECT2_API Logger *createConsoleLogger(Logger::Level level); |
| 61 | +LIBFREENECT2_API Logger *createConsoleLoggerWithDefaultLevel(); |
| 62 | + |
| 63 | +//libfreenect2 frees the memory of the logger passed in. |
| 64 | +LIBFREENECT2_API Logger *getGlobalLogger(); |
| 65 | +LIBFREENECT2_API void setGlobalLogger(Logger *logger); |
| 66 | + |
| 67 | +} /* namespace libfreenect2 */ |
| 68 | +#endif /* LIBFREENECT2_LOGGER_H_ */ |
0 commit comments