[go: nahoru, domu]

Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[iOS] Avoid using os/log.h because it is only supported on iOS9 and l…
Browse files Browse the repository at this point in the history
…ater. (#2486)
  • Loading branch information
wqyfavor authored and YorkShen committed May 28, 2019
1 parent 4416ebc commit 87783c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
12 changes: 4 additions & 8 deletions ios/sdk/WeexSDK/Sources/Bridge/WXCoreBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@
#import <objc/runtime.h>
#include <fstream>

#ifdef DEBUG
#include <os/log.h>
#endif

namespace WeexCore
{
static void consoleWithArguments(NSArray *arguments, WXLogFlag logLevel)
Expand Down Expand Up @@ -950,16 +946,16 @@ virtual void log(LogLevel level, const char* file, unsigned long line, const cha
#ifdef DEBUG
switch (level) {
case LogLevel::Error:
os_log_error(OS_LOG_DEFAULT, "<%s:Error|%s:%lu> %s\n", WEEX_CORE_LOG_TAG, file, line, log);
printf("<%s:Error|%s:%lu> %s\n", WEEX_CORE_LOG_TAG, file, line, log);
break;
case LogLevel::Warn:
os_log_error(OS_LOG_DEFAULT, "<%s:Warn|%s:%lu> %s\n", WEEX_CORE_LOG_TAG, file, line, log);
printf("<%s:Warn|%s:%lu> %s\n", WEEX_CORE_LOG_TAG, file, line, log);
break;
case LogLevel::Info:
os_log_info(OS_LOG_DEFAULT, "<%s:Info|%s:%lu> %s\n", WEEX_CORE_LOG_TAG, file, line, log);
printf("<%s:Info|%s:%lu> %s\n", WEEX_CORE_LOG_TAG, file, line, log);
break;
case LogLevel::Debug:
os_log_debug(OS_LOG_DEFAULT, "<%s:Debug|%s:%lu> %s\n", WEEX_CORE_LOG_TAG, file, line, log);
printf("<%s:Debug|%s:%lu> %s\n", WEEX_CORE_LOG_TAG, file, line, log);
break;
default:
break;
Expand Down
10 changes: 4 additions & 6 deletions weex_core/Source/base/log_defines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@

#ifdef __ANDROID__
#include <android/log.h>
#elif __APPLE__
#include <os/log.h>
#endif

#include "core/manager/weex_core_manager.h"
Expand Down Expand Up @@ -106,16 +104,16 @@ namespace WeexCore {
#elif __APPLE__
switch (level) {
case LogLevel::Error:
os_log_error(OS_LOG_DEFAULT, "<%s:Error|%s:%lu> %s\n", WEEX_CORE_LOG_TAG, file, line, log.str());
printf("<%s:Error|%s:%lu> %s\n", WEEX_CORE_LOG_TAG, file, line, log.str());
break;
case LogLevel::Warn:
os_log_error(OS_LOG_DEFAULT, "<%s:Warn|%s:%lu> %s\n", WEEX_CORE_LOG_TAG, file, line, log.str());
printf("<%s:Warn|%s:%lu> %s\n", WEEX_CORE_LOG_TAG, file, line, log.str());
break;
case LogLevel::Info:
os_log_info(OS_LOG_DEFAULT, "<%s:Info|%s:%lu> %s\n", WEEX_CORE_LOG_TAG, file, line, log.str());
printf("<%s:Info|%s:%lu> %s\n", WEEX_CORE_LOG_TAG, file, line, log.str());
break;
case LogLevel::Debug:
os_log_debug(OS_LOG_DEFAULT, "<%s:Debug|%s:%lu> %s\n", WEEX_CORE_LOG_TAG, file, line, log.str());
printf("<%s:Debug|%s:%lu> %s\n", WEEX_CORE_LOG_TAG, file, line, log.str());
break;
default:
break;
Expand Down

0 comments on commit 87783c6

Please sign in to comment.