| /* -*- Mode: C++; tab-width: 4 indent-tabs-mode: nil -*- |
| * |
| * Copyright (c) 2015 Nest Labs, Inc. |
| * All rights reserved. |
| * |
| * This document is the property of Nest. It is considered |
| * confidential and proprietary information. |
| * |
| * This document may not be reproduced or transmitted in any form, |
| * in whole or in part, without the express written permission of |
| * Nest. |
| * |
| * Description: |
| * This is the source file used to hook into gtest framework and |
| * return whether print_log flag is specified or not. |
| * |
| */ |
| |
| #include "gtest.h" |
| #include "nlerlog.h" |
| #include "nlerlogmanager.h" |
| |
| extern nl_log_printer_t gLogger; |
| |
| nl_log_printer_t prev_gLogger = NULL; |
| |
| static int gtest_print_log() { |
| return testing::GTEST_FLAG(print_log); |
| } |
| |
| void gtest_start_shield_log(void) { |
| if (!gtest_print_log() && gLogger) { |
| prev_gLogger = gLogger; |
| gLogger = NULL; |
| } |
| } |
| |
| void gtest_end_shield_log(void) { |
| if (!gtest_print_log()) { |
| if (!gLogger && prev_gLogger) { |
| gLogger = prev_gLogger; |
| prev_gLogger = NULL; |
| } |
| } |
| } |