Add miniglog

This commit is contained in:
Kalman
2018-11-16 16:30:13 +08:00
parent 8331b8415d
commit 2096f93a92
80 changed files with 1948 additions and 313 deletions

View File

@@ -18,12 +18,10 @@
#include <boost/range/iterator_range.hpp>
#endif
#include <glog/logging.h>
#include <algorithm>
#include <thread>
#include "mynteye/glog_init.h"
#include "mynteye/logger.h"
#include "mynteye/utils.h"
#include "api/plugin.h"
@@ -92,7 +90,7 @@ bool dir_exists(const std::string &p) {
std::vector<std::string> get_plugin_paths() {
std::string info_path(MYNTEYE_SDK_INSTALL_DIR);
info_path.append(OS_SEP "share" OS_SEP "mynteye" OS_SEP "build.info");
info_path.append(MYNTEYE_OS_SEP "share" MYNTEYE_OS_SEP "mynteye" MYNTEYE_OS_SEP "build.info");
cv::FileStorage fs(info_path, cv::FileStorage::READ);
if (!fs.isOpened()) {
@@ -189,13 +187,13 @@ std::vector<std::string> get_plugin_paths() {
std::vector<std::string> dirs{MYNTEYE_SDK_ROOT_DIR, MYNTEYE_SDK_INSTALL_DIR};
for (auto &&plat : plats) {
for (auto &&dir : dirs) {
auto &&plat_dir = dir + OS_SEP "plugins" + OS_SEP + plat;
auto &&plat_dir = dir + MYNTEYE_OS_SEP "plugins" + MYNTEYE_OS_SEP + plat;
// VLOG(2) << "plat_dir: " << plat_dir;
if (!dir_exists(plat_dir))
continue;
for (auto &&name : names) {
// VLOG(2) << " name: " << name;
auto &&path = plat_dir + OS_SEP + name;
auto &&path = plat_dir + MYNTEYE_OS_SEP + name;
if (!file_exists(path))
continue;
paths.push_back(path);

View File

@@ -13,7 +13,7 @@
// limitations under the License.
#include "api/processor/depth_processor.h"
#include <glog/logging.h>
#include "mynteye/logger.h"
#include <utility>

View File

@@ -15,10 +15,10 @@
#include <opencv2/imgproc/imgproc.hpp>
#include <glog/logging.h>
#include <utility>
#include "mynteye/logger.h"
MYNTEYE_BEGIN_NAMESPACE
DisparityNormalizedProcessor::DisparityNormalizedProcessor(

View File

@@ -15,10 +15,10 @@
#include <opencv2/calib3d/calib3d.hpp>
#include <glog/logging.h>
#include <utility>
#include "mynteye/logger.h"
MYNTEYE_BEGIN_NAMESPACE
DisparityProcessor::DisparityProcessor(std::int32_t proc_period)

View File

@@ -15,10 +15,10 @@
#include <opencv2/calib3d/calib3d.hpp>
#include <glog/logging.h>
#include <utility>
#include "mynteye/logger.h"
MYNTEYE_BEGIN_NAMESPACE
PointsProcessor::PointsProcessor(cv::Mat Q, std::int32_t proc_period)

View File

@@ -13,11 +13,11 @@
// limitations under the License.
#include "api/processor/processor.h"
#include <glog/logging.h>
#include <exception>
#include <utility>
#include "mynteye/logger.h"
#include "internal/strings.h"
#include "internal/times.h"

View File

@@ -16,10 +16,10 @@
#include <opencv2/calib3d/calib3d.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <glog/logging.h>
#include <utility>
#include "mynteye/logger.h"
#include "device/device.h"
MYNTEYE_BEGIN_NAMESPACE

View File

@@ -13,13 +13,14 @@
// limitations under the License.
#include "api/synthetic.h"
#include <glog/logging.h>
#include <opencv2/imgproc/imgproc.hpp>
#include <algorithm>
#include <functional>
#include <stdexcept>
#include "mynteye/logger.h"
#include "api/plugin.h"
#include "api/processor/depth_processor.h"
#include "api/processor/disparity_normalized_processor.h"

View File

@@ -13,7 +13,7 @@
// limitations under the License.
#include "device/context.h"
#include <glog/logging.h>
#include "mynteye/logger.h"
#include "device/device.h"
#include "uvc/uvc.h"

View File

@@ -13,13 +13,14 @@
// limitations under the License.
#include "device/device.h"
#include <glog/logging.h>
#include <algorithm>
#include <iterator>
#include <stdexcept>
#include <utility>
#include "mynteye/logger.h"
#include "device/device_s.h"
#include "internal/async_callback.h"
#include "internal/channels.h"

View File

@@ -13,7 +13,7 @@
// limitations under the License.
#include "device/device_s.h"
#include <glog/logging.h>
#include "mynteye/logger.h"
#include "internal/motions.h"

View File

@@ -15,11 +15,11 @@
#define MYNTEYE_INTERNAL_ASYNC_CALLBACK_IMPL_H_
#pragma once
#include <glog/logging.h>
#include <string>
#include <utility>
#include "mynteye/logger.h"
MYNTEYE_BEGIN_NAMESPACE
template <class Data>

View File

@@ -13,8 +13,6 @@
// limitations under the License.
#include "internal/channels.h"
#include <glog/logging.h>
#include <bitset>
#include <chrono>
#include <iomanip>
@@ -25,6 +23,8 @@
#include "internal/strings.h"
#include "internal/times.h"
#include "mynteye/logger.h"
#define IMU_TRACK_PERIOD 25 // ms
MYNTEYE_BEGIN_NAMESPACE

View File

@@ -13,7 +13,7 @@
// limitations under the License.
#include "internal/dl.h"
#include <glog/logging.h>
#include "mynteye/logger.h"
MYNTEYE_BEGIN_NAMESPACE

View File

@@ -12,8 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "internal/files.h"
#include <glog/logging.h>
#include "mynteye/logger.h"
#if defined(OS_WIN) && !defined(OS_MINGW) && !defined(OS_CYGWIN)
#include <direct.h>
@@ -51,7 +50,7 @@ bool _mkdir(const std::string &path) {
}
bool mkdir(const std::string &path) {
auto &&dirs = strings::split(path, OS_SEP);
auto &&dirs = strings::split(path, MYNTEYE_OS_SEP);
auto &&size = dirs.size();
if (size <= 0)
return false;
@@ -59,7 +58,7 @@ bool mkdir(const std::string &path) {
if (!_mkdir(p))
return false;
for (std::size_t i = 1; i < size; i++) {
p.append(OS_SEP).append(dirs[i]);
p.append(MYNTEYE_OS_SEP).append(dirs[i]);
if (!_mkdir(p))
return false;
}

View File

@@ -13,7 +13,7 @@
// limitations under the License.
#include "internal/motions.h"
#include <glog/logging.h>
#include "mynteye/logger.h"
#include "internal/channels.h"

View File

@@ -13,14 +13,13 @@
// limitations under the License.
#include "internal/streams.h"
#include <glog/logging.h>
#include <algorithm>
#include <chrono>
#include <iomanip>
#include <stdexcept>
#include "internal/types.h"
#include "mynteye/logger.h"
MYNTEYE_BEGIN_NAMESPACE

View File

@@ -13,11 +13,11 @@
// limitations under the License.
#include "internal/types.h"
#include <glog/logging.h>
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <sstream>
#include "mynteye/logger.h"
MYNTEYE_BEGIN_NAMESPACE

View File

@@ -16,13 +16,13 @@
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
#define GLOG_NO_ABBREVIATED_SEVERITIES
#endif
#include <glog/logging.h>
#ifdef HAVE_LIB_GFLAGS
#include <gflags/gflags.h>
#endif
#include "mynteye/mynteye.h"
#include "mynteye/logger.h"
int main(int /*argc*/, char *argv[]) {
// Set whether log messages go to stderr instead of logfiles

41
src/public/miniglog.cc Normal file
View File

@@ -0,0 +1,41 @@
// Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2012 Google Inc. All rights reserved.
// http://code.google.com/p/ceres-solver/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of Google Inc. nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Author: keir@google.com (Keir Mierle)
#include "mynteye/miniglog.h"
namespace google {
// This is the set of log sinks. This must be in a separate library to ensure
// that there is only one instance of this across the entire program.
std::set<google::LogSink *> log_sinks_global;
int log_severity_global(INFO);
} // namespace google

View File

@@ -0,0 +1,3 @@
miniglog:
* https://github.com/arpg/miniglog
* https://github.com/tzutalin/miniglog

View File

@@ -13,11 +13,11 @@
// limitations under the License.
#include "mynteye/types.h"
#include <glog/logging.h>
#include <iomanip>
#include <limits>
#include "mynteye/logger.h"
#define FULL_PRECISION \
std::fixed << std::setprecision(std::numeric_limits<double>::max_digits10)

View File

@@ -13,11 +13,11 @@
// limitations under the License.
#include "mynteye/utils.h"
#include <glog/logging.h>
#include "device/context.h"
#include "device/device.h"
#include "mynteye/logger.h"
MYNTEYE_BEGIN_NAMESPACE
namespace device {

View File

@@ -13,9 +13,9 @@
// limitations under the License.
#include "uvc/uvc.h" // NOLINT
#include <glog/logging.h>
#include <libuvc/libuvc.h>
#include "mynteye/logger.h"
// #define ENABLE_DEBUG_SPAM
MYNTEYE_BEGIN_NAMESPACE

View File

@@ -16,6 +16,9 @@
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/stat.h>
@@ -25,13 +28,14 @@
#include <linux/uvcvideo.h>
#include <linux/videodev2.h>
#include <glog/logging.h>
#include <chrono>
#include <fstream>
#include <sstream>
#include <string>
#include <thread>
#include "mynteye/logger.h"
MYNTEYE_BEGIN_NAMESPACE
namespace uvc {

View File

@@ -53,7 +53,7 @@
#include <strsafe.h>
#include <glog/logging.h>
#include "mynteye/logger.h"
#define VLOG_INFO VLOG(2)
// #define VLOG_INFO LOG(INFO)