Skip to content

Update client logging #195

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

Merged
merged 5 commits into from
Jun 5, 2024
Merged

Conversation

davidfischer
Copy link
Contributor

  • Exposes control of logging with data-ea-verbosity
  • Makes some debug/info messages not visible by default
  • Downgrades "already loaded" from error->warning
  • Increases "No ad placements found" (missing div) from debug->warning

- Exposes control of logging with `data-ea-verbosity`
- Makes some debug/info messages not visible by default
- Downgrades "already loaded" from error->warning
- Increases "No ad placements found" (missing div) from debug->warning
@davidfischer davidfischer requested review from a team and ericholscher May 24, 2024 23:38
@@ -921,7 +956,7 @@ export function load_placements(force_load = false) {
let elements = Array.prototype.slice.call(node_list);

if (elements.length === 0) {
console.debug("No ad placements found.");
logger.warn("No ad placements found.");
Copy link
Member

Choose a reason for hiding this comment

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

Should we provide more context here? I feel like as a user this message is not super helpful..

Suggested change
logger.warn("No ad placements found.");
logger.warn("No ad placements found. Check your publisher account is correct and has ads enabled.");

Copy link
Contributor Author

@davidfischer davidfischer May 29, 2024

Choose a reason for hiding this comment

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

I'm ok with this but there are a few reasons why this can happen. There can be no ads available for their geo/targeting or settings (they've disabled house ads while paid ads aren't enabled).

Edit: This message is when there's no ad div to place the ad. This should probably be a message like "No ad placements found. https://ethical-ad-client.readthedocs.io/en/latest/#usage"

@@ -1071,17 +1122,17 @@ if (check_dependencies()) {
if (err instanceof Error) {
if (err instanceof EthicalAdsWarning) {
// Report these at a lower log level
console.debug(err.message);
logger.warn(err.message);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we want these at warning. The main things that are displayed from this message are when there are no ads to show and when the ad request is blocked (ad blocker) or invalid (wrong publisher account). I think we want these to be visible at default verbosity.

Copy link
Member

Choose a reason for hiding this comment

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

Yea, makes sense 👍

@davidfischer davidfischer merged commit cf1cb27 into main Jun 5, 2024
4 checks passed
@davidfischer davidfischer deleted the davidfischer/update-client-logging branch June 5, 2024 22:11
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.

2 participants