creating custom function to log actions in plugin

Just change the action hook to:

add_action( 'update_history', 'update_history', 10, 4 );

It will work.

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