michael@0: /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ michael@0: /* vim: set ts=2 et sw=2 tw=40: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef DOM_CAMERA_CAMERACOMMON_H michael@0: #define DOM_CAMERA_CAMERACOMMON_H michael@0: michael@0: #ifndef __func__ michael@0: #ifdef __FUNCTION__ michael@0: #define __func__ __FUNCTION__ michael@0: #else michael@0: #define __func__ __FILE__ michael@0: #endif michael@0: #endif michael@0: michael@0: #ifndef NAN michael@0: #define NAN std::numeric_limits::quiet_NaN() michael@0: #endif michael@0: michael@0: #include "prlog.h" michael@0: michael@0: #ifdef PR_LOGGING michael@0: extern PRLogModuleInfo* GetCameraLog(); michael@0: #define DOM_CAMERA_LOG( type, ... ) PR_LOG(GetCameraLog(), (PRLogModuleLevel)type, ( __VA_ARGS__ )) michael@0: #else michael@0: #define DOM_CAMERA_LOG( type, ... ) michael@0: #endif michael@0: michael@0: #define DOM_CAMERA_LOGA( ... ) DOM_CAMERA_LOG( 0, __VA_ARGS__ ) michael@0: michael@0: /** michael@0: * From the least to the most output. michael@0: */ michael@0: enum { michael@0: DOM_CAMERA_LOG_NOTHING, michael@0: DOM_CAMERA_LOG_ERROR, michael@0: DOM_CAMERA_LOG_WARNING, michael@0: DOM_CAMERA_LOG_INFO, michael@0: DOM_CAMERA_LOG_TRACE, michael@0: DOM_CAMERA_LOG_REFERENCES michael@0: }; michael@0: michael@0: /** michael@0: * DOM_CAMERA_LOGR() can be called before 'gCameraLog' is set, so michael@0: * we need to handle this one a little differently. michael@0: */ michael@0: #ifdef PR_LOGGING michael@0: #define DOM_CAMERA_LOGR( ... ) \ michael@0: do { \ michael@0: if (GetCameraLog()) { \ michael@0: DOM_CAMERA_LOG( DOM_CAMERA_LOG_REFERENCES, __VA_ARGS__ ); \ michael@0: } \ michael@0: } while (0) michael@0: #else michael@0: #define DOM_CAMERA_LOGR( ... ) michael@0: #endif michael@0: #define DOM_CAMERA_LOGT( ... ) DOM_CAMERA_LOG( DOM_CAMERA_LOG_TRACE, __VA_ARGS__ ) michael@0: #define DOM_CAMERA_LOGI( ... ) DOM_CAMERA_LOG( DOM_CAMERA_LOG_INFO, __VA_ARGS__ ) michael@0: #define DOM_CAMERA_LOGW( ... ) DOM_CAMERA_LOG( DOM_CAMERA_LOG_WARNING, __VA_ARGS__ ) michael@0: #define DOM_CAMERA_LOGE( ... ) DOM_CAMERA_LOG( DOM_CAMERA_LOG_ERROR, __VA_ARGS__ ) michael@0: michael@0: #endif // DOM_CAMERA_CAMERACOMMON_H