Added logging to library.

Added logging every important function. 

As previous pull-request, this continues, so only important commit is d53d2ddf8fca135f84d62af3689de6252b466c46