Skip to content

Conversation

@Muhammad-Abdullah-shahzad
Copy link

@Muhammad-Abdullah-shahzad Muhammad-Abdullah-shahzad commented Oct 19, 2025

Summary

  • Adds automatic default level calculation when createLogger() is called with custom levels but no level specified.
  • Ensures that the logger defaults to the median level if no level is provided.
  • Adds Jest unit tests to verify the default level behavior with different custom levels and the silent option.

Tests

  • 4 unit tests covering:
    1.should default to low level if level not specified.
    2. Default to fourth level in multi-level custom config.
    3.Should default to second level if level specified.
    4. should default to info level if level not specified and levels not specified

Motivation

This improves usability for developers using custom log levels without needing to explicitly set a default value.
if developer explicitly gives a level value it will override default level value.

@Muhammad-Abdullah-shahzad
Copy link
Author

@indexzero I've created a pr addressing the issue #1491.Please have a look and let me know if changes required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant