:language_std_outputs: std::cout, std::cerr, printf, std::print

== Why is this an issue?

include::../description.adoc[]

If you are using Flutter, you can use `debugPrint` or surround print calls with a check for `kDebugMode`.

=== Code examples

The following noncompliant code:

[source,dart,diff-id=1,diff-type=noncompliant]
----
void f(int x) {
  // ...
  print('debug: $x');
  // ...
}
----

Could be replaced by:

[source,dart,diff-id=1,diff-type=compliant]
----
void doSomething(int x)
{
  // ...
  debugPrint('debug: $x');
  // ...
}
----

or

[source,dart,diff-id=1,diff-type=compliant]
----
void doSomething(int x)
{
  // ...
  if (kDebugMode) {
    print('debug: $x');
  }
  // ...
}
----

or

[source,dart,diff-id=1,diff-type=compliant]
----
void doSomething(int x)
{
  // ...
  log('log: $x');
  // ...
}
----

== Resources

* OWASP - https://owasp.org/Top10/A09_2021-Security_Logging_and_Monitoring_Failures/[Top 10 2021 Category A9 - Security Logging and Monitoring Failures]
* OWASP - https://owasp.org/www-project-top-ten/2017/A3_2017-Sensitive_Data_Exposure[Top 10 2017 Category A3 - Sensitive Data Exposure]
