代码拉取完成,页面将自动刷新
diff --git a/scheduler/hilog-helper.c b/scheduler/hilog-helper.c
new file mode 100644
index 0000000..28d986d
--- /dev/null
+++ b/scheduler/hilog-helper.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * 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.
+ */
+
+#include "hilog-helper.h"
+#include <stdarg.h>
+#include "hilog/log_c.h"
+#include "string.h"
+
+void hilogPrint(int level, const char *message)
+{
+ if (strchr(message, '.') || strchr(message, '/')) {
+ HiLogPrint(LOG_CORE, LOG_INFO, 0xD001C00, "cupslog", "%{private}s", message);
+ } else {
+ HiLogPrint(LOG_CORE, LOG_INFO, 0xD001C00, "cupslog", "%{public}s", message);
+ }
+}
+
diff --git a/scheduler/hilog-helper.h b/scheduler/hilog-helper.h
new file mode 100644
index 0000000..7baa470
--- /dev/null
+++ b/scheduler/hilog-helper.h
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * 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.
+ */
+
+void hilogPrint(int level, const char *message);
\ No newline at end of file
diff --git a/scheduler/log.c b/scheduler/log.c
index 0fe7f3a..6eb66fe 100644
--- a/scheduler/log.c
+++ b/scheduler/log.c
@@ -22,7 +22,7 @@
# include <systemd/sd-journal.h>
#endif /* HAVE_ASL_H */
#include <syslog.h>
-
+#include "hilog-helper.h"
/*
* Constants for log keys from PWG 5110.3 (PWG Common Log Format)...
@@ -1267,7 +1267,7 @@ cupsdWriteErrorLog(int level, /* I - Log level */
/*
* Write the log message...
*/
-
+ hilogPrint(level, message);
cupsFilePrintf(ErrorFile, "%c %s %s\n", levels[level],
cupsdGetDateTime(NULL, LogTimeFormat), message);
cupsFileFlush(ErrorFile);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。