Questions tagged [debug-print]

Debug print may refer to any method of debugging application using simple text output.

Simple text debugging methods differ between programing languages.

Javascript

In javascript, developers usually use alert function to get the variable contents or the console.log (may not be browser compatible) method. The latter has the advantage of being non-blocking. Using alert is only possible for small amounts of data since we must confirm each dialog.

PHP

In PHP echo, print_R and var_dump are used to debug. Statement echo only outputs text, but latter two functions are also formatting complicated variable strictures (arrays, objects).

C++

In C++ std::cout is used to output data to console. The iostream library must be included to do so.

20 questions
26
votes
4 answers

Does Rust have a debug macro?

In C++, I use something like this DEBUG macro: #ifdef DEBUG #define DEBUG_STDERR(x) (std::cerr << (x)) #define DEBUG_STDOUT(x) (std::cout << (x)) #else #define DEBUG_STDERR(x) #define DEBUG_STDOUT(x) #endif Does Rust have something similar?
user3384741
  • 1,261
  • 3
  • 16
  • 21
18
votes
1 answer

How to use "RAISE INFO, RAISE LOG, RAISE DEBUG” to track log in PostgreSQL function?

CREATE OR REPLACE FUNCTION mover(src text, dst text, cpquery text, conname text, ifbin boolean) returns void as $$ DECLARE cnt integer; dlcnt integer; del_count integer; ret…
Simon Su
  • 2,143
  • 6
  • 20
  • 21
16
votes
3 answers

How to disable all Logs [debugPrint()] in release build in flutter?

I have installed a release build apk in the android device but if I connect that device to Android studio then I am able to see all Logs/debugPrint statements. Is there any way to disable the all the logs ?
Ajay Kumar
  • 15,250
  • 14
  • 54
  • 53
9
votes
3 answers

Print a type's name at compile time without aborting compilation?

In this question: Print template typename at compile time we have a few suggestions regarding how to get typical C++ compilers to print a type's name, at compile time. However, they rely on triggering a compilation error. My question: Can I get the…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
5
votes
0 answers

Should I provide ostream << operators for types in a library?

I'm working on a C++ wrapper library for some API. Suppose I've implemented some struct or class type Foo. I can't make up my mind whether or not to provide an ostream& operator<<(ostream& os, const Foo& x) with my library. On one hand: It's…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
4
votes
1 answer

Debug.Print in VBA

In VBA Debug.Print prints to the Immediate window. I just found out that using a semicolon (;) makes it print at the position of the caret/text cursor which seems odd. Debug.Print "a" & "b" & "c" Debug.Print ; "a"; "b"; "c" Debug.Print "a", "b",…
user7393973
  • 2,270
  • 1
  • 20
  • 58
3
votes
2 answers

Display exception information and Debug.Print() messages in Immediate Window

A friend of mine claims that calls to Debug.Print() as well as first-chance exception notifications appear in the Immediate Window for him. I found this surprising; for me they only appear in the Output Window. MSDN claims (here) that you can…
Timwi
  • 65,159
  • 33
  • 165
  • 230
3
votes
1 answer

C++ debug print to stream generates warnings

I saw this debug print for c++ here on stackoverflow but I can't comment it (I'm a newbie): #ifdef DEBUG #define dout cout #else #define dout 0 && cout #endif It is used like this: dout << "in foobar with x= " << x << " and y= " << y << '\n'; At…
Mankka
  • 521
  • 3
  • 12
2
votes
2 answers

How do I use a macro with variable arguments?

see my code #include #define DPRINTF(_fmt, ...) debugPrintf(_fmt,__VA_ARGS__) void debugPrintf(const char *fmt, ...) { char buf[128]; va_list ap; va_start(ap, fmt); vsnprintf(buf, sizeof(buf), fmt,…
Jeegar Patel
  • 26,264
  • 51
  • 149
  • 222
2
votes
1 answer

In Swift (5), how to I pass an "Any..." parameter to a print() statement without it printing as an array?

I have a global enum I use for global functions that I only want to run when the app is in debug. It looks something like this: public enum Debug { static func print(_ items: Any..., separator: String = " ", terminator: String = "\n") { …
A. L. Strine
  • 611
  • 1
  • 7
  • 23
2
votes
1 answer

Print/Output variable values to immediate window

I'm trying to write some vba that will print the values which satisfy the below constraints: b * k = t * k lambda = r * (k - 1) / (t - 1), where (t - 1) >= (k - 1) & lambda must be an integer. Here is the algorithm: Sub BIBDs() Dim t, b, k, r…
RTrain3k
  • 845
  • 1
  • 13
  • 27
2
votes
1 answer

Where can I read the output of g_print while debugging a GTK+ 3.0 project in VS2013?

I have a GTK+3.0 project running in VS2013 I added to my linker command line options this argument: /ENTRY:mainCRTStartup I suspect that might be related to the fact that I have no output in VS that shows the messages printed with g_print I also…
tmsimont
  • 2,651
  • 2
  • 25
  • 36
2
votes
2 answers

Escaping Safety with Debug Statements

I know of debug writeln("Some good debug message") in pure functions but what about functions that I have carefully tagged as @safe or @trusted? DMD currently doesn't allow debug writeln's in those because writeln and similar are currently…
Nordlöw
  • 11,838
  • 10
  • 52
  • 99
2
votes
2 answers

Print_R of class as array

I have a class, that actually operates over a complicated array to make the manipulation more simple. The format of original array looks like this: array( array( "name" =>"foo", "type" =>8, //The array is NBT format and 8…
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
1
vote
1 answer

Fail a grunt build when debug prints exist in source

I am working on a PHP/Javascript project where I've nicely set up a build workflow. It involves testing, minifying, compressing into the final zip deliverable, and a whole lot of other nice stuff. I want to build a task that fails when there are…
alexg
  • 3,015
  • 3
  • 23
  • 36
1
2