Proyectos de Subversion Iphone Microlearning

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
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 "Crashlytics/Crashlytics/Helpers/FIRCLSFile.h"
18
 
19
__BEGIN_DECLS
20
 
21
#ifdef __OBJC__
22
extern NSString* const FIRCLSStartTimeKey;
23
extern NSString* const FIRCLSFirstRunloopTurnTimeKey;
24
extern NSString* const FIRCLSInBackgroundKey;
25
#if TARGET_OS_IPHONE
26
extern NSString* const FIRCLSDeviceOrientationKey;
27
extern NSString* const FIRCLSUIOrientationKey;
28
#endif
29
extern NSString* const FIRCLSUserIdentifierKey;
30
extern NSString* const FIRCLSUserNameKey;
31
extern NSString* const FIRCLSUserEmailKey;
32
extern NSString* const FIRCLSDevelopmentPlatformNameKey;
33
extern NSString* const FIRCLSDevelopmentPlatformVersionKey;
34
extern NSString* const FIRCLSOnDemandRecordedExceptionsKey;
35
extern NSString* const FIRCLSOnDemandDroppedExceptionsKey;
36
#endif
37
 
38
extern const uint32_t FIRCLSUserLoggingMaxKVEntries;
39
 
40
typedef struct {
41
  const char* incrementalPath;
42
  const char* compactedPath;
43
 
44
  uint32_t maxIncrementalCount;
45
  uint32_t maxCount;
46
} FIRCLSUserLoggingKVStorage;
47
 
48
typedef struct {
49
  const char* aPath;
50
  const char* bPath;
51
  uint32_t maxSize;
52
  uint32_t maxEntries;
53
  bool restrictBySize;
54
  uint32_t* entryCount;
55
} FIRCLSUserLoggingABStorage;
56
 
57
typedef struct {
58
  FIRCLSUserLoggingKVStorage userKVStorage;
59
  FIRCLSUserLoggingKVStorage internalKVStorage;
60
 
61
  FIRCLSUserLoggingABStorage logStorage;
62
  FIRCLSUserLoggingABStorage errorStorage;
63
  FIRCLSUserLoggingABStorage customExceptionStorage;
64
} FIRCLSUserLoggingReadOnlyContext;
65
 
66
typedef struct {
67
  const char* activeUserLogPath;
68
  const char* activeErrorLogPath;
69
  const char* activeCustomExceptionPath;
70
  uint32_t userKVCount;
71
  uint32_t internalKVCount;
72
  uint32_t errorsCount;
73
} FIRCLSUserLoggingWritableContext;
74
 
75
void FIRCLSUserLoggingInit(FIRCLSUserLoggingReadOnlyContext* roContext,
76
                           FIRCLSUserLoggingWritableContext* rwContext);
77
 
78
#ifdef __OBJC__
79
void FIRCLSUserLoggingRecordUserKeyValue(NSString* key, id value);
80
void FIRCLSUserLoggingRecordUserKeysAndValues(NSDictionary* keysAndValues);
81
void FIRCLSUserLoggingRecordInternalKeyValue(NSString* key, id value);
82
void FIRCLSUserLoggingWriteInternalKeyValue(NSString* key, NSString* value);
83
 
84
void FIRCLSUserLoggingRecordError(NSError* error, NSDictionary<NSString*, id>* additionalUserInfo);
85
 
86
NSDictionary* FIRCLSUserLoggingGetCompactedKVEntries(FIRCLSUserLoggingKVStorage* storage,
87
                                                     bool decodeHex);
88
void FIRCLSUserLoggingCompactKVEntries(FIRCLSUserLoggingKVStorage* storage);
89
 
90
void FIRCLSUserLoggingRecordKeyValue(NSString* key,
91
                                     id value,
92
                                     FIRCLSUserLoggingKVStorage* storage,
93
                                     uint32_t* counter);
94
 
95
void FIRCLSUserLoggingRecordKeysAndValues(NSDictionary* keysAndValues,
96
                                          FIRCLSUserLoggingKVStorage* storage,
97
                                          uint32_t* counter);
98
 
99
void FIRCLSUserLoggingWriteAndCheckABFiles(FIRCLSUserLoggingABStorage* storage,
100
                                           const char** activePath,
101
                                           void (^openedFileBlock)(FIRCLSFile* file));
102
 
103
NSArray* FIRCLSUserLoggingStoredKeyValues(const char* path);
104
 
105
OBJC_EXTERN void FIRCLSLog(NSString* format, ...) NS_FORMAT_FUNCTION(1, 2);
106
OBJC_EXTERN void FIRCLSLogToStorage(FIRCLSUserLoggingABStorage* storage,
107
                                    const char** activePath,
108
                                    NSString* format,
109
                                    ...) NS_FORMAT_FUNCTION(3, 4);
110
 
111
#endif
112
 
113
__END_DECLS