• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1diff --git a/scheduler/hilog-helper.c b/scheduler/hilog-helper.c
2new file mode 100644
3index 0000000..331563c
4--- /dev/null
5+++ b/scheduler/hilog-helper.c
6@@ -0,0 +1,30 @@
7+/*
8+ * Copyright (c) 2024 Huawei Device Co., Ltd.
9+ * Licensed under the Apache License, Version 2.0 (the "License");
10+ * you may not use this file except in compliance with the License.
11+ * You may obtain a copy of the License at
12+ *
13+ *     http://www.apache.org/licenses/LICENSE-2.0
14+ *
15+ * Unless required by applicable law or agreed to in writing, software
16+ * distributed under the License is distributed on an "AS IS" BASIS,
17+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+ * See the License for the specific language governing permissions and
19+ * limitations under the License.
20+ */
21+
22+#include "hilog-helper.h"
23+#include <stdarg.h>
24+#include "hilog/log_c.h"
25+#include "string.h"
26+
27+void hilogPrint(int level, const char *message)
28+{
29+    if (strchr(message, '.') || strchr(message, '/') || strstr(message, "job-name") ||
30+         strstr(message, "uuid") || strstr(message, "argv") || strstr(message, "document-name")) {
31+        HiLogPrint(LOG_CORE, LOG_INFO, 0xD0050B0, "cupslog", "%{private}s", message);
32+    } else {
33+        HiLogPrint(LOG_CORE, LOG_INFO, 0xD0050B0, "cupslog", "%{public}s", message);
34+    }
35+}
36+
37diff --git a/scheduler/hilog-helper.h b/scheduler/hilog-helper.h
38new file mode 100644
39index 0000000..7baa470
40--- /dev/null
41+++ b/scheduler/hilog-helper.h
42@@ -0,0 +1,16 @@
43+/*
44+ * Copyright (c) 2024 Huawei Device Co., Ltd.
45+ * Licensed under the Apache License, Version 2.0 (the "License");
46+ * you may not use this file except in compliance with the License.
47+ * You may obtain a copy of the License at
48+ *
49+ *     http://www.apache.org/licenses/LICENSE-2.0
50+ *
51+ * Unless required by applicable law or agreed to in writing, software
52+ * distributed under the License is distributed on an "AS IS" BASIS,
53+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
54+ * See the License for the specific language governing permissions and
55+ * limitations under the License.
56+ */
57+
58+void hilogPrint(int level, const char *message);
59\ No newline at end of file
60diff --git a/scheduler/log.c b/scheduler/log.c
61index 8a2996e..9278934 100644
62--- a/scheduler/log.c
63+++ b/scheduler/log.c
64@@ -25,6 +25,7 @@
65 #ifndef va_copy
66 #  define va_copy(__list1, __list2) ((void)(__list1 = __list2))
67 #endif
68+#include "hilog-helper.h"
69
70
71 /*
72@@ -1270,7 +1271,7 @@ cupsdWriteErrorLog(int        level,	/* I - Log level */
73    /*
74     * Write the log message...
75     */
76-
77+    hilogPrint(level, message);
78     cupsFilePrintf(ErrorFile, "%c %s %s\n", levels[level],
79                    cupsdGetDateTime(NULL, LogTimeFormat), message);
80     cupsFileFlush(ErrorFile);
81