The number of digits in n (base 10) is ⌊log10(n)⌋+1. For example, n=1234 has 4 digits, and log10(1234)≈3.09.
This works because 10k−1≤n<10k, so k=⌊log10(n)⌋+1. You can compute the number of digits without converting to a string.
Algorithms that process digits (like summing digits or reversing a number) run in O(log10n) time, which is the same as O(logn) in Big-O notation.