is there any function to store logs & send mail to admin?

is there any function to store logs & send mail to admin?

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)