The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Поиск:  Каталог документации

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.




Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру