Some Features From Console

I started using console in Yii. I had a special code for using console before. I am looking for 2 things I had that time.

(Yes, I used to use functions instead of OOP)

1. something like console_log($message); And after that I got a message:

[1.0346] Message 1.

[4.1537] Message 2.

Dmesg in linux has pretty similar.

Between them I see how many seconds have just left.

2. There is an unique process. I cannot allow to the Cron start the procces before the first one is not finished.

I have a dir of pids of processes. For example class Xyz is in process then its pid has to be in /pid/Xyz.pid (inside the only integer of pid).

After starting the second process it checks the pid in /pid/Xyz.pid and checks this process is running or not.

So I miss these things in Yii and cannot find them.

Did anybody hear about it ? What can you advice?