Logging implementation

added logs calls
todo: if sql error while loggin, write to file