Caudium HOWTO
Prev Chapter 6. Developing with Caudium Next

6.6. How to print something to debug log file

With Caudium you can output something to the web page or to the debug log file located in ../logs/debug/default.* . This way the end-user will not see any line you can output in your debug log file. Sending output to the debug log file is simple, just write to stdout:


write("my message to log file\n");
      
It is also usually useful to use sprintf to format what you want to output:

int i = 2; write(sprintf("i=%d\n", i));
      
This line will output i=2 , but it is better when you output array or mapping, as Pike is able to print them in a human-comprehensible format:

array a = ({ "test", "test2", 2 }); write(sprintf("a=%O\n", a));
      
Which will output:

a = ({ /* 2 elements */
    "test",
    "test2"
})
      

Note

the %O format is very useful since it can output any type from int to mapping. The only type you can't format is object.


Prev Home Next
How to use a backtrace Up How to help the Caudium community


  • Bookmark
  • Add Resource
  • Modify Resource
  • Get Rated
  • Link to Us
  • Advertise
  • Contact
  • Search Resources

  • Recommended

    • Web Site Templates
    • Ultimate Trading Script
    • The Exterminator
    • Guestbook Script
    • Thumbnail Creator
    • Custom Programming
    • PHP Forums
    • Ajax Tutorial
  • Resource Map

    • Home
    • Expanded Directory
    • New Listings
    • Most Popular
    • Top Rated
    • Email Updates
    • Random Link
    • Advanced Search
    • Bookmark Us
    • Link to Us
    • Advertising Info
    • Webmaster Forum
    • Accessibility Statement
  • General Resources

    • ASP
    • C/C++
    • ColdFusion
    • Flash / ActionScript
    • General
    • HTML
    • Java
    • JavaScript
    • Perl
    • PHP
    • Python
    • Remotely Hosted
    • Unix Shell
    • Visual Basic
    • XML
  • Scripts & Programs

    • ASP
    • C/C++
    • ColdFusion
    • Flash / ActionScript
    • Java
    • JavaScript
    • Perl
    • PHP
    • Python
    • Remotely Hosted
    • Unix Shell
    • Visual Basic
    • XML
  • Online Tutorials

    • ASP
    • C/C++
    • ColdFusion
    • Flash / ActionScript
    • HTML
    • Howtos
    • Java
    • JavaScript
    • Perl
    • PHP
    • Python
    • Unix Shell
    • Visual Basic
    • XML
  • Books

    • ASP
    • C/C++
    • ColdFusion
    • Flash / ActionScript
    • HTML
    • Java
    • JavaScript
    • Perl
    • PHP
    • Python
    • Unix Shell
    • Visual Basic
    • XML
  • Supporters

    • Bigwebmaster Supporters
    • Ozzu Website Templates
    • Loans
    • Loans
    • Best Credit Cards
    • Credit Cards
    • Cheap Car Insurance
  • Partners

    • Unmelted Templates
    • Web Design Forum