The Logger.Write method has various overloads including one where you could simply pass the message you want to log. Using that overload logs the message using the trace listeners defined under the default category you set. There are other overloads
which would not require you to create a LogEntry object, check those out.
On the concern regarding possible typo errors on specifying categories, I would agree that's a valid point. I'd probably define an enumeration for this and make sure to inform the developers about this.
With regards to constructing messages, you could consider the following:
1. If the only information you need to be logged is the message itself, just go for using the overload passing the actual message or if necessary, with the addition of the category.
2. If you need other things, explore the other constructors of a LogEntry to avoid using 10 lines of code repeatedly.
3. If none of the constructors suit your need, consider creating a helper class that provides you with methods that encapsulates the logic of creating a LogEntry object parameterizing those values which you want to actually use.
By the way, if you're using EntLib 5.0, it's encouraged that you use the LogWriter class instead of the Logger static class.
LogWriter logWriter = EnterpriseLibraryContainer.Current.GetInstance<LogWriter>();
The overloads of the Logger.Write and LogWriter.Write are pretty much the same.
Global Technology and Solutions