diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2019-02-09 02:17:09 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2019-02-09 02:17:09 +0000 |
commit | ae97ddcc37e8586a521106c4815fae588026c4c3 (patch) | |
tree | 381500d252fdd68884f8f4a7906ee093d7ce323c /network/netmgr/log.h | |
parent | a3408c502312181dbe653a29ceb16819d5b51926 (diff) | |
parent | b05b939d85b47ed8c2b53114f8116699b859df09 (diff) | |
download | android_device_generic_goldfish-ae97ddcc37e8586a521106c4815fae588026c4c3.tar.gz android_device_generic_goldfish-ae97ddcc37e8586a521106c4815fae588026c4c3.tar.bz2 android_device_generic_goldfish-ae97ddcc37e8586a521106c4815fae588026c4c3.zip |
Snap for 5180536 from b05b939d85b47ed8c2b53114f8116699b859df09 to pi-platform-release
Change-Id: Ia280cb31af947b41f4f81d6a47532468c05143ce
Diffstat (limited to 'network/netmgr/log.h')
-rw-r--r-- | network/netmgr/log.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/network/netmgr/log.h b/network/netmgr/log.h new file mode 100644 index 0000000..1efe72a --- /dev/null +++ b/network/netmgr/log.h @@ -0,0 +1,45 @@ +/* + * Copyright 2018, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#define LOG_TAG "netmgr" +#include <log/log.h> +#include <stdio.h> + +extern bool isTerminal; +void initIsTerminal(); + +// Print errors to stderr if running from a terminal, otherwise print to logcat +// This is useful for debugging from a terminal +#define LOGE(...) do { \ + if (isTerminal) { \ + fprintf(stderr, __VA_ARGS__); \ + fprintf(stderr, "\n"); \ + } else { \ + ALOGE(__VA_ARGS__); \ + } \ +} while (0) + +#define LOGW(...) do { \ + if (isTerminal) { \ + fprintf(stderr, __VA_ARGS__); \ + fprintf(stderr, "\n"); \ + } else { \ + ALOGW(__VA_ARGS__); \ + } \ +} while (0) + |