Logarithmic laws and applications