NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Newbie : Debug object ?


Joined: 10 Nov 2011
Posts: 2
Location: France
Reply with quote
Hello,

Do we have in PhpEd an object in which we can print outputs, calling a simple function :

debug_print ("my text to print inside debug object");

It looks like echo, but instead of printing text in current stream, it prints it in a debugging window.

This tools is very useful for me.

Christian
View user's profileFind all posts by c2hSend private message
Guru master

Joined: 24 Jul 2009
Posts: 737
Reply with quote
You can use OutputDebugString to write messages to the Log panel:

Code:
$v = 1234;
OutputDebugString('v = ' . $v);


If you right-click the Log panel, you can Filter messages to include for example just ODS, so you only see OutputDebugString messages. You can then also tick the Log panel to Auto Activate which means PhpED will automatically display the panel every time you get a debug string.

Bear in mind OutputDebugString() is not a standard PHP statement, so if you accidentally release a site to production and it contains that statement, it will probably fail to run. For that reason some developers are of the belief that you should not use special debug statements (DebugBreak, OutputDebugString, etc.) whilst testing.

You could define your own OutputDebugString() stub function to allow running in a non-debug environment without having to change your code:

Code:
if (! function_exists('OutputDebugString')) {
  function OutputDebugString($string) {
  }
}
View user's profileFind all posts by plugnplaySend private message


Joined: 10 Nov 2011
Posts: 2
Location: France
Reply with quote
Thanks. It helps me a lot.

Christian
View user's profileFind all posts by c2hSend private message
Newbie : Debug object ?
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic