1 |
efrain |
1 |
// Copyright 2019 Google
|
|
|
2 |
//
|
|
|
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 |
#pragma once
|
|
|
16 |
|
|
|
17 |
#include <stdio.h>
|
|
|
18 |
|
|
|
19 |
#if __OBJC__
|
|
|
20 |
#import "Crashlytics/Crashlytics/Helpers/FIRCLSLogger.h"
|
|
|
21 |
#define FIRCLSDeveloperLog(label, __FORMAT__, ...) \
|
|
|
22 |
FIRCLSDebugLog(@"[" label "] " __FORMAT__, ##__VA_ARGS__);
|
|
|
23 |
#endif
|
|
|
24 |
|
|
|
25 |
typedef enum {
|
|
|
26 |
FIRCLSInternalLogLevelUnknown = 0,
|
|
|
27 |
FIRCLSInternalLogLevelDebug = 1,
|
|
|
28 |
FIRCLSInternalLogLevelInfo = 2,
|
|
|
29 |
FIRCLSInternalLogLevelWarn = 3,
|
|
|
30 |
FIRCLSInternalLogLevelError = 4
|
|
|
31 |
} FIRCLSInternalLogLevel;
|
|
|
32 |
|
|
|
33 |
typedef struct {
|
|
|
34 |
int logFd;
|
|
|
35 |
FIRCLSInternalLogLevel logLevel;
|
|
|
36 |
} FIRCLSInternalLoggingWritableContext;
|
|
|
37 |
|
|
|
38 |
#define FIRCLSSDKLogDebug(__FORMAT__, ...) \
|
|
|
39 |
FIRCLSSDKFileLog(FIRCLSInternalLogLevelDebug, "DEBUG [%s:%d] " __FORMAT__, __FUNCTION__, \
|
|
|
40 |
__LINE__, ##__VA_ARGS__)
|
|
|
41 |
#define FIRCLSSDKLogInfo(__FORMAT__, ...) \
|
|
|
42 |
FIRCLSSDKFileLog(FIRCLSInternalLogLevelInfo, "INFO [%s:%d] " __FORMAT__, __FUNCTION__, \
|
|
|
43 |
__LINE__, ##__VA_ARGS__)
|
|
|
44 |
#define FIRCLSSDKLogWarn(__FORMAT__, ...) \
|
|
|
45 |
FIRCLSSDKFileLog(FIRCLSInternalLogLevelWarn, "WARN [%s:%d] " __FORMAT__, __FUNCTION__, \
|
|
|
46 |
__LINE__, ##__VA_ARGS__)
|
|
|
47 |
#define FIRCLSSDKLogError(__FORMAT__, ...) \
|
|
|
48 |
FIRCLSSDKFileLog(FIRCLSInternalLogLevelError, "ERROR [%s:%d] " __FORMAT__, __FUNCTION__, \
|
|
|
49 |
__LINE__, ##__VA_ARGS__)
|
|
|
50 |
|
|
|
51 |
#define FIRCLSSDKLog FIRCLSSDKLogWarn
|
|
|
52 |
|
|
|
53 |
__BEGIN_DECLS
|
|
|
54 |
|
|
|
55 |
void FIRCLSSDKFileLog(FIRCLSInternalLogLevel level, const char* format, ...) __printflike(2, 3);
|
|
|
56 |
|
|
|
57 |
__END_DECLS
|