Files
react-native/packages/react-native/ReactCxxPlatform/react/logging/DefaultLogger.cpp
T
Andrew Datsenko 798eb0ab84 move rncxx logging (#50652)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50652

Changelog: [Internal]

Reviewed By: zeyap

Differential Revision: D72800216

fbshipit-source-id: 722546b4538fce0d30d90a346a737a564bfd21ee
2025-04-11 08:06:06 -07:00

36 lines
863 B
C++

/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "DefaultLogger.h"
#include <glog/logging.h>
#include <logger/react_native_log.h>
#include <string>
namespace facebook::react {
Logger getDefaultLogger() {
return [](const std::string& message, unsigned int logLevel) {
static std::string tag = "[JavaScript]: ";
switch (logLevel) {
case ReactNativeLogLevelFatal:
case ReactNativeLogLevelError:
LOG(ERROR) << tag << message;
break;
case ReactNativeLogLevelWarning:
LOG(WARNING) << tag << message;
break;
case ReactNativeLogLevelInfo:
default:
LOG(INFO) << tag << message;
break;
}
};
}
} // namespace facebook::react