web-branch-deep-linking-attribution icon indicating copy to clipboard operation
web-branch-deep-linking-attribution copied to clipboard

feat(SDK-2217): add logger with loglevel support

Open JagadeeshKaricherla-branch opened this issue 1 year ago • 1 comments

add logger with loglevel support

Pull Request Template

Description

The logger supports different log levels, enabling developers to control the verbosity of log messages based on their requirements.

Logger Implementation

The Web SDK Logger is implemented as part of the Web SDK package. It provides methods for setting the log level and logging messages at various levels of severity.

Log Levels

The following log levels are supported:

  • Verbose: enables full logging - shows/prints all console.info, console.warn, console.error messages
  • Info: shows/prints all console.info, console.warn, console.error messages
  • Warning: shows/prints all console.warn, console.error messages
  • Error: default.shows/prints all console.error messages.
  • None: disables all logging.

Usage

Setting Log Level

set the logLevel method inside init options

branch.init(
    branch_key,
    options: {
        logLevel: 'verbose',
        timeout: 500,
        retry_delay: 400
    },
    callback(err, data),
);

Fixes # (issue) : SDK-2217

Type of change

Please delete options that are not relevant.

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • [ ] Unit test
  • [ ] Integration test

JS Budget Check

Please mention the size in kb before abd after this PR

Files Before After
dist/build.js.
dist/build.min.js

Checklist:

  • [ ] My code follows the style guidelines of this project
  • [ ] I have performed a self-review of my own code
  • [ ] I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] My changes generate no new warnings
  • [ ] I have added tests that prove my fix is effective or that my feature works
  • [ ] New and existing unit tests pass locally with my changes
  • [ ] Any dependent changes have been merged and published in downstream modules
  • [ ] I have checked my code and corrected any misspellings

Mentions:

List the person or team responsible for reviewing proposed changes.

cc @BranchMetrics/saas-sdk-devs for visibility.

Test Results

  1 files  ± 0    1 suites  ±0   1m 2s :stopwatch: +5s 177 tests +18  170 :white_check_mark: +18  7 :zzz: ±0  0 :x: ±0  180 runs  +18  173 :white_check_mark: +18  7 :zzz: ±0  0 :x: ±0 

Results for commit c59ade5c. ± Comparison against base commit e2b3837e.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Apr 16 '24 17:04 github-actions[bot]