提交 95316f57 编写于 作者: X xionglei6

fix:log fix

Signed-off-by: Nxionglei6 <xionglei6@huawei.com>
上级 11ab7bb0
...@@ -11,103 +11,128 @@ ...@@ -11,103 +11,128 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import("//base/startup/init_lite/begetd.gni") if (defined(ohos_lite)) {
import("//build/ohos.gni") static_library("libbegetutil") {
sources = [ "//base/startup/init_lite/services/log/init_log.c" ]
defines = [
"_GNU_SOURCE",
"OHOS_LITE",
"INIT_LOG_INIT=3",
]
include_dirs = [
"./include",
"//third_party/bounds_checking_function/include",
"//base/startup/init_lite/services/include",
"//base/startup/init_lite/services/include/param",
"//base/startup/init_lite/interfaces/innerkits/fd_holder",
]
deps = [
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
"//base/startup/init_lite/services/loopevent:loopevent",
"//base/startup/init_lite/services/utils:libinit_tools",
"//third_party/bounds_checking_function:libsec_static",
]
}
} else {
import("//base/startup/init_lite/begetd.gni")
import("//build/ohos.gni")
config("exported_header_files") { config("exported_header_files") {
visibility = [ ":*" ] visibility = [ ":*" ]
include_dirs = [ "include/" ] include_dirs = [ "include/" ]
} }
fs_manager_sources = [
"fs_manager/fstab.c",
"fs_manager/fstab_mount.c",
]
ohos_shared_library("libbegetutil") { fs_manager_sources = [
sources = [ "fs_manager/fstab.c",
"//base/startup/init_lite/services/log/init_log.c", "fs_manager/fstab_mount.c",
"fd_holder/fd_holder.c",
"fd_holder/fd_holder_internal.c",
"file/init_file.c",
"reboot/init_reboot_innerkits.c",
"service_control/service_control.c",
"socket/init_socket.c",
"syscap/init_syscap.c",
]
sources += fs_manager_sources
defines = [ "INIT_AGENT" ]
include_dirs = [
"./include",
"//third_party/bounds_checking_function/include",
"//base/startup/init_lite/services/include",
"//base/startup/init_lite/services/include/param",
"//base/startup/init_lite/interfaces/innerkits/fd_holder",
]
deps = [
"//base/startup/init_lite/services/loopevent:loopevent",
"//base/startup/init_lite/services/param:param_client",
"//base/startup/init_lite/services/utils:libinit_tools",
"//base/startup/init_lite/services/utils:libinit_utils",
"//third_party/bounds_checking_function:libsec_shared",
"//third_party/openssl:libcrypto_static",
"//utils/native/base:utils",
] ]
external_deps = [ "hilog_native:libhilog_base" ]
public_configs = [ ":exported_header_files" ]
part_name = "init"
install_images = [
"system",
"updater",
]
}
# watcher lib must separate compilation avoid interdependence. ohos_shared_library("libbegetutil") {
ohos_shared_library("libbeget_proxy") { sources = [
sources = [ "//base/startup/init_lite/services/log/init_log.c",
"//base/startup/init_lite/device_info/device_info_kits.cpp", "fd_holder/fd_holder.c",
"//base/startup/init_lite/device_info/device_info_proxy.cpp", "fd_holder/fd_holder_internal.c",
"//base/startup/init_lite/services/log/init_log.c", "file/init_file.c",
"service_watcher/service_watcher.c", "reboot/init_reboot_innerkits.c",
] "service_control/service_control.c",
"socket/init_socket.c",
"syscap/init_syscap.c",
]
sources += fs_manager_sources
defines = [ "INIT_AGENT" ]
include_dirs = [ include_dirs = [
"./include", "./include",
"//base/startup/init_lite/device_info", "//third_party/bounds_checking_function/include",
"//utils/native/base/include", "//base/startup/init_lite/services/include",
"//base/startup/init_lite/interfaces/innerkits/include", "//base/startup/init_lite/services/include/param",
"//base/startup/init_lite/services/include", "//base/startup/init_lite/interfaces/innerkits/fd_holder",
"//base/startup/init_lite/services/include/param", ]
"//third_party/bounds_checking_function/include", deps = [
] "//base/startup/init_lite/services/loopevent:loopevent",
"//base/startup/init_lite/services/param:param_client",
"//base/startup/init_lite/services/utils:libinit_tools",
"//base/startup/init_lite/services/utils:libinit_utils",
"//third_party/bounds_checking_function:libsec_shared",
"//third_party/openssl:libcrypto_static",
"//utils/native/base:utils",
]
external_deps = [ "hilog_native:libhilog_base" ]
public_configs = [ ":exported_header_files" ]
part_name = "init"
install_images = [
"system",
"updater",
]
}
defines = [ "INIT_AGENT" ] # watcher lib must separate compilation avoid interdependence.
deps = [ ohos_shared_library("libbeget_proxy") {
"//base/startup/init_lite/services/param/watcher:param_watcheragent", sources = [
"//base/startup/init_lite/services/utils:libinit_utils", "//base/startup/init_lite/device_info/device_info_kits.cpp",
"//third_party/bounds_checking_function:libsec_shared", "//base/startup/init_lite/device_info/device_info_proxy.cpp",
"//utils/native/base:utils", "//base/startup/init_lite/services/log/init_log.c",
] "service_watcher/service_watcher.c",
]
external_deps = [ include_dirs = [
"hilog_native:libhilog_base", "./include",
"ipc:ipc_core", "//base/startup/init_lite/device_info",
"safwk:system_ability_fwk", "//utils/native/base/include",
"samgr_standard:samgr_proxy", "//base/startup/init_lite/interfaces/innerkits/include",
] "//base/startup/init_lite/services/include",
part_name = "init" "//base/startup/init_lite/services/include/param",
install_images = [ "system" ] "//third_party/bounds_checking_function/include",
} ]
# For init only defines = [ "INIT_AGENT" ]
ohos_static_library("libfsmanager_static") { deps = [
sources = fs_manager_sources "//base/startup/init_lite/services/param/watcher:param_watcheragent",
include_dirs = [ "//base/startup/init_lite/services/utils:libinit_utils",
"//base/startup/init_lite/interfaces/innerkits/include", "//third_party/bounds_checking_function:libsec_shared",
"//third_party/bounds_checking_function/include", "//utils/native/base:utils",
"//base/startup/init_lite/services/log", ]
"//base/startup/init_lite/services/include",
] external_deps = [
"hilog_native:libhilog_base",
"ipc:ipc_core",
"safwk:system_ability_fwk",
"samgr_standard:samgr_proxy",
]
part_name = "init"
install_images = [ "system" ]
}
# For init only
ohos_static_library("libfsmanager_static") {
sources = fs_manager_sources
include_dirs = [
"//base/startup/init_lite/interfaces/innerkits/include",
"//third_party/bounds_checking_function/include",
"//base/startup/init_lite/services/log",
"//base/startup/init_lite/services/include",
]
part_name = "init" part_name = "init"
}
} }
...@@ -13,13 +13,19 @@ ...@@ -13,13 +13,19 @@
if (defined(ohos_lite)) { if (defined(ohos_lite)) {
static_library("init_log") { static_library("init_log") {
sources = [ "init_log.c" ] sources = [ "init_log.c" ]
defines = [ "OHOS_LITE" ] defines = [
public_deps = [ "//third_party/bounds_checking_function:libsec_static" ] "_GNU_SOURCE",
"OHOS_LITE",
"INIT_LOG_INIT=1",
]
include_dirs = [ include_dirs = [
"//base/hiviewdfx/hilog_lite/interfaces/native/kits", "//base/hiviewdfx/hilog_lite/interfaces/native/kits",
"//base/startup/init_lite/interfaces/innerkits/include", "//base/startup/init_lite/interfaces/innerkits/include",
] ]
deps = [ "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared" ] deps = [
"//third_party/bounds_checking_function:libsec_static",
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_static"
]
} }
} else { } else {
import("//build/ohos.gni") import("//build/ohos.gni")
......
...@@ -23,6 +23,9 @@ ...@@ -23,6 +23,9 @@
#include "securec.h" #include "securec.h"
#ifdef OHOS_LITE #ifdef OHOS_LITE
#ifndef INIT_LOG_INIT
#define INIT_LOG_INIT LOG_CORE
#endif
#include "hilog/log.h" #include "hilog/log.h"
#endif #endif
#ifdef INIT_AGENT #ifdef INIT_AGENT
...@@ -112,7 +115,7 @@ void InitLog(InitLogLevel logLevel, unsigned int domain, const char *tag, const ...@@ -112,7 +115,7 @@ void InitLog(InitLogLevel logLevel, unsigned int domain, const char *tag, const
va_end(vargs); va_end(vargs);
#ifdef OHOS_LITE #ifdef OHOS_LITE
static LogLevel LOG_LEVEL[] = { LOG_DEBUG, LOG_INFO, LOG_WARN, LOG_ERROR, LOG_FATAL }; static LogLevel LOG_LEVEL[] = { LOG_DEBUG, LOG_INFO, LOG_WARN, LOG_ERROR, LOG_FATAL };
(void)HiLogPrint(LOG_CORE, LOG_LEVEL[logLevel], domain, tag, "%{public}s", tmpFmt); (void)HiLogPrint(INIT_LOG_INIT, LOG_LEVEL[logLevel], domain, tag, "%{public}s", tmpFmt);
#else #else
#ifdef INIT_DMESG #ifdef INIT_DMESG
LogToDmesg(logLevel, tag, tmpFmt); LogToDmesg(logLevel, tag, tmpFmt);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册