Well, I don't know if thats what I want. But here is my problem:
In case of some error I am logging the FILE, CLASS, FUNCTION and LINE in a file. For that I am doing something like:
myLog('['. __FILE__ . ']' . '[' . __CLASS__ . ']' . '[' . __FUNCTION__ . ']' . '[' . __LINE__ . ']');
The problem is everywhere I've to repeat that code in the parameter. and If I want to change the format, I've to change everywhere.
How can I have something like:
myLog(LOG_MSG_FORMAT);
With PHP define it is not possible since it will give my the LINE number of the place where that definition is, not where the definition is getting used.
Any solution to this is welcome. I am not bitchy about having C like functionality of #def.
EDIT: The function does not necessarily be called only in case of errors. It is just that I want to log the the file, line, etc. wherever I am calling that function. So if I just paste a code somewhere "", it should log the line, etc.
For example:
<?php
...
...
<log this location>
...
...
<log this location>