Skip to content

Turn off logging for testing calls. #3275

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

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

Conversation

polina-c
Copy link
Contributor

@polina-c polina-c commented Apr 26, 2025

Contributes to #3270.

This is one option to turn off logging for probes.
I am open to brainstorm for better ones.

If looks good, I will extend it to other handlers and add test coverage.

Copy link

PR Health

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

Coverage ✔️
File Coverage

This check for test coverage is informational (issues shown here will not fail the PR).

API leaks ✔️

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

Package Leaked API symbols
License Headers ✔️
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files
no missing headers

All source files should start with a license header.

Unrelated files missing license headers
Files
pkgs/samples/lib/brick_breaker.dart
pkgs/samples/lib/fibonacci.dart
pkgs/samples/lib/google_ai.dart
pkgs/samples/lib/hello_world.dart
pkgs/samples/lib/main.dart
pkgs/samples/lib/sunflower.dart

}

var setLoggingOn = true;
assert(() {
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the purpose of turning logging off when running in debug mode?

Copy link
Contributor Author

@polina-c polina-c Apr 29, 2025

Choose a reason for hiding this comment

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

It was your request to turn off logging for probes, right? So, if we turn off logging for ui in debug mode, propes and other dev related calls will not be logged.

Another option is to add a tag to such logs.

Did I miss something?

Copy link
Contributor

@johnpryan johnpryan Apr 29, 2025

Choose a reason for hiding this comment

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

That's correct, I think I understand why this is written this way. I just wanted to make sure that we are still able to log requests when running dart_services locally. This class is defined in dartpad_shared, but as long as it's only used in dartpad_ui this should be okay.

Maybe this class should be defined in dartpad_ui to avoid confusion?

/// It can be set to false in constructor.
late final bool loggingOn;

DartPadRequestHeaders({bool? loggingOn}) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I would rename this to enableLogging to match other flags in the DartPad project (enableGenAi, enable-experiments, etc)


import 'headers.dart';

class DartPadBackendClient {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: rename to DartServicesClient for consistency

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