Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several improvements in the “Test-Network” and “Write-ToLog” functions. #809

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mchave3
Copy link
Contributor

@mchave3 mchave3 commented Jan 14, 2025

Proposed Changes

I've implemented several improvements in the “Test-Network” and “Write-ToLog” functions :

Improved Logging function :

  • Changed $LogMsg to a mandatory parameter.
  • Optimized ACL settings for the log file.
  • Added try/catch block for error handling.
  • Modified the "Echo log" behavior to improve clarity.
  • Added UTF-8 encoding for better character support.

Enhanced Test-Network function:

  • Added robust error handling for registry key access and web requests.
  • Introduced configurable parameters for timeout and retry intervals.
  • Improved logging with detailed error messages for troubleshooting.
  • Refactored metered connection check for better readability and maintainability.
  • Ensured default fallback values for NCSI parameters when registry keys are unavailable.

Related Issues

(Github link to related issues or pull requests)

- Changed $LogMsg to a mandatory parameter.
- Optimized ACL settings for the log file.
- Added try/catch block for error handling.
- Modified the "Echo log" behavior to improve clarity.
- Added UTF-8 encoding for better character support.
- Added robust error handling for registry key access and web requests.
- Introduced configurable parameters for timeout and retry intervals.
- Improved logging with detailed error messages for troubleshooting.
- Restored notification logic:
  - Warning notification after 5 minutes of no connection.
  - Timeout notification after 30 minutes of no connection.
- Refactored metered connection check for better readability and maintainability.
- Ensured default fallback values for NCSI parameters when registry keys are unavailable.
- # DevSkim: ignore DS137138 Insecure URL
@mchave3 mchave3 deployed to megalinter January 14, 2025 08:55 — with GitHub Actions Active
Copy link
Owner

@Romanitho Romanitho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your help ;)

Write-ToLog "WAU is configured to force update checking on metered connection"
return $true

}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're missing this part of the logs. If you think it's not important, that's fine with me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes exactly, I forgot this part, you can put it back.

@AndrewDemski-ad-gmail-com
Copy link
Contributor

Hi, why the Devskim error suppression was removed?
I do not see any benefit coming from that decision.

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.

3 participants