Skip to content

Latest commit

 

History

History
40 lines (25 loc) · 826 Bytes

File metadata and controls

40 lines (25 loc) · 826 Bytes

@appzung/react-native-code-push v11.0.3


@appzung/react-native-code-push / setLogger

Function: setLogger()

setLogger(logger): void

Set a custom logger function to handle all CodePush logs

Parameters

logger

LoggerFunction

A function that takes a log level and message and handles the logging

Returns

void

Example

import { setLogger, LogLevel } from '@appzung/react-native-code-push';

// Custom logger that sends critical logs to a crash reporting service
setLogger((level, message) => {
  // Always log to console
  console.log(`[CodePush] ${message}`);

  // Send error logs to crash reporting
  if (level === LogLevel.ERROR) {
    MyCrashReportingService.log(`CodePush error: ${message}`);
  }
});