Log Configuration
Log Initialization Configuration
var logger = uni.requireNativePlugin("GCUniPlugin-Logger");
logger.setConfig({
enableLinkRumData: true,
enableCustomLog: true,
discardStrategy: 'discardOldest'
});
| Parameter Name |
Parameter Type |
Required |
Parameter Description |
| samplerate |
number |
No |
Sampling rate, range [0,1], default 1 |
| enableLinkRumData |
boolean |
No |
Whether to associate with RUM |
| enableCustomLog |
boolean |
No |
Whether to enable custom logs |
| discardStrategy |
string |
No |
Log discard strategy: discard, discardOldest |
| logLevelFilters |
array |
No |
Log level filters: info, warning, error, critical, ok |
| globalContext |
object |
No |
Custom global parameters |
| logCacheLimitCount |
number |
No |
Local cache maximum log entry count limit, default 5000 |
Logger Log Printing
var logger = uni.requireNativePlugin("GCUniPlugin-Logger");
logger.logging({
content: 'Log content',
status: status
});
API - logging
| Field |
Type |
Required |
Description |
| content |
string |
Yes |
Log content, can be a JSON string |
| status |
string |
Yes |
Log level |
| property |
object |
No |
Event context |
Log Levels
| String |
Meaning |
| info |
Info |
| warning |
Warning |
| error |
Error |
| critical |
Critical |
| ok |
Ok |