As others have said, the formula works for a logarithm of any base, because of the change-of-base formula. However, the accepted answer says, “The practical reason for using base 10 was a little old fashioned: it allowed the use of tables of logarithms instead of a calculator and reducing these calculations to addition and subtraction.” This raises the question, why did those tables use base 10? After all, we just explained that the same tricks work for any base at all. If you just needed to pick one base to compile a table of and print as a book, or mark on a slide rule, wouldn’t the least-arbitrary choice have been e?
The answer behind the answer is that base-10 logarithms are the easiest for humans without calculators and used to decimal numbers to work with. The log of 1 is 0, the log of 10 is 1, the log of 100 is 2, and so on up, so any one-digit number has a log of zero point something, any two-digit number has a log of one point something, and so forth. So, without a calculator, what’s the log of 300? Well, log 300 is log 3·100, which is log 3 + log 100. The square root of 10 is a little more than 3, so log 3 is a little less than 0.5, and log 100 is exactly 2, so intuitively it’s a little less than 2.5. That makes it really easy to find the log of any number in scientific notation, or move a decimal point left or right.
If you did a lot of these, which engineers once had to, you’d quickly get an intuitive sense for it. And doing these problems with base 10 lets you use that number sense to catch silly mistakes: “No, that can’t be right, it’s something thousand, so the log has to be three point something.”