1 /*
2 * Copyright (c) 2021 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #ifndef SOFTBUS_LOG_H
17 #define SOFTBUS_LOG_H
18
19 #include <stdint.h>
20 #include "softbus_adapter_log.h"
21
22 #ifdef __cplusplus
23 #if __cplusplus
24 extern "C" {
25 #endif
26 #endif
27
28 typedef enum {
29 SOFTBUS_LOG_AUTH,
30 SOFTBUS_LOG_TRAN,
31 SOFTBUS_LOG_CONN,
32 SOFTBUS_LOG_LNN,
33 SOFTBUS_LOG_DISC,
34 SOFTBUS_LOG_COMM,
35 SOFTBUS_LOG_MODULE_MAX,
36 } SoftBusLogModule;
37
38 void SoftBusLog(SoftBusLogModule module, SoftBusLogLevel level, const char *fmt, ...);
39
40 #define UUID_ANONYMIZED_LENGTH 4
41 #define NETWORKID_ANONYMIZED_LENGTH 4
42 #define UDID_ANONYMIZED_LENGTH 4
43
44 const char *Anonymizes(const char *target, const uint8_t expectAnonymizedLength);
45
AnonymizesUUID(const char * input)46 inline const char *AnonymizesUUID(const char *input)
47 {
48 return Anonymizes(input, UUID_ANONYMIZED_LENGTH);
49 }
50
AnonymizesNetworkID(const char * input)51 inline const char *AnonymizesNetworkID(const char *input)
52 {
53 return Anonymizes(input, NETWORKID_ANONYMIZED_LENGTH);
54 }
55
AnonymizesUDID(const char * input)56 inline const char *AnonymizesUDID(const char *input)
57 {
58 return Anonymizes(input, UDID_ANONYMIZED_LENGTH);
59 }
60
61 #ifdef __cplusplus
62 #if __cplusplus
63 }
64 #endif /* __cplusplus */
65 #endif /* __cplusplus */
66
67 #endif /* SOFTBUS_LOG_H */
68