2012-07-30 14:59:05 -07:00
|
|
|
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=40: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef DOM_CAMERA_CAMERACOMMON_H
|
|
|
|
#define DOM_CAMERA_CAMERACOMMON_H
|
|
|
|
|
|
|
|
#ifndef __func__
|
|
|
|
#ifdef __FUNCTION__
|
|
|
|
#define __func__ __FUNCTION__
|
|
|
|
#else
|
|
|
|
#define __func__ __FILE__
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2015-05-19 11:15:34 -07:00
|
|
|
#include "mozilla/Logging.h"
|
2012-07-30 14:59:05 -07:00
|
|
|
|
2012-10-29 16:32:10 -07:00
|
|
|
extern PRLogModuleInfo* GetCameraLog();
|
2015-06-03 15:25:57 -07:00
|
|
|
#define DOM_CAMERA_LOG( type, ... ) MOZ_LOG(GetCameraLog(), (mozilla::LogLevel)type, ( __VA_ARGS__ ))
|
2012-07-30 14:59:05 -07:00
|
|
|
|
2015-06-03 15:25:57 -07:00
|
|
|
#define DOM_CAMERA_LOGA( ... ) DOM_CAMERA_LOG( mozilla::LogLevel::Error, __VA_ARGS__ )
|
2012-07-30 14:59:05 -07:00
|
|
|
|
2012-09-04 18:01:56 -07:00
|
|
|
/**
|
|
|
|
* From the least to the most output.
|
|
|
|
*/
|
2012-07-30 14:59:05 -07:00
|
|
|
enum {
|
|
|
|
DOM_CAMERA_LOG_NOTHING,
|
|
|
|
DOM_CAMERA_LOG_ERROR,
|
|
|
|
DOM_CAMERA_LOG_WARNING,
|
2012-09-04 18:01:56 -07:00
|
|
|
DOM_CAMERA_LOG_INFO,
|
|
|
|
DOM_CAMERA_LOG_TRACE,
|
|
|
|
DOM_CAMERA_LOG_REFERENCES
|
2012-07-30 14:59:05 -07:00
|
|
|
};
|
|
|
|
|
2012-09-04 18:01:56 -07:00
|
|
|
/**
|
|
|
|
* DOM_CAMERA_LOGR() can be called before 'gCameraLog' is set, so
|
|
|
|
* we need to handle this one a little differently.
|
|
|
|
*/
|
|
|
|
#define DOM_CAMERA_LOGR( ... ) \
|
|
|
|
do { \
|
2012-10-29 16:32:10 -07:00
|
|
|
if (GetCameraLog()) { \
|
2012-09-04 18:01:56 -07:00
|
|
|
DOM_CAMERA_LOG( DOM_CAMERA_LOG_REFERENCES, __VA_ARGS__ ); \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
#define DOM_CAMERA_LOGT( ... ) DOM_CAMERA_LOG( DOM_CAMERA_LOG_TRACE, __VA_ARGS__ )
|
|
|
|
#define DOM_CAMERA_LOGI( ... ) DOM_CAMERA_LOG( DOM_CAMERA_LOG_INFO, __VA_ARGS__ )
|
|
|
|
#define DOM_CAMERA_LOGW( ... ) DOM_CAMERA_LOG( DOM_CAMERA_LOG_WARNING, __VA_ARGS__ )
|
|
|
|
#define DOM_CAMERA_LOGE( ... ) DOM_CAMERA_LOG( DOM_CAMERA_LOG_ERROR, __VA_ARGS__ )
|
|
|
|
|
2012-07-30 14:59:05 -07:00
|
|
|
#endif // DOM_CAMERA_CAMERACOMMON_H
|