mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Adding the RCTLog binding to Facebook app. More context is in D30271863 (https://github.com/facebook/react-native/commit/c317a709d5657f30b9d839f8676f23a62731dcd5) Changelog: [Internal] Reviewed By: philIip Differential Revision: D31299188 fbshipit-source-id: 5234242e2f82262f9d2538e6c689f4a3738f37bb
40 lines
969 B
Plaintext
40 lines
969 B
Plaintext
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#import "RCTDefaultCxxLogFunction.h"
|
|
#import <React/RCTLog.h>
|
|
#import <glog/logging.h>
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
void RCTDefaultCxxLogFunction(ReactNativeLogLevel level, const char *message)
|
|
{
|
|
NSString *messageString = [NSString stringWithUTF8String:message];
|
|
|
|
switch (level) {
|
|
case ReactNativeLogLevelInfo:
|
|
LOG(INFO) << message;
|
|
RCTLogInfo(@"%@", messageString);
|
|
break;
|
|
case ReactNativeLogLevelWarning:
|
|
LOG(WARNING) << message;
|
|
RCTLogWarn(@"%@", messageString);
|
|
break;
|
|
case ReactNativeLogLevelError:
|
|
LOG(ERROR) << message;
|
|
RCTLogError(@"%@", messageString);
|
|
break;
|
|
case ReactNativeLogLevelFatal:
|
|
LOG(FATAL) << message;
|
|
break;
|
|
}
|
|
}
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|