Tech Off Post

Single Post Permalink

View Thread: Error-Logging Class, input please.
  • User profile image

    That's exactly when aspect-oriented programming would come in handy.

    I did such a logger once upon a time. I was lucky since I had one single method that I passed in the stuff that had to be saved and another method that I passed in the stuff that had to be loaded.

    What I did was outputting something like:

    User INSERT <TABLE> <paramslist> SUCCESS

    where I used to parse the SQL statement and success of that method to return me that string.

    You could probably go with an enum that is converted to a string (by a method that perhaps does a lookup in a resources file) to determine your action...

    You could perhaps even go further and store the data that you require for your logging in a database and define some rules (dunno if you could do that directly in the database - depents on your scenario) that are then looked up in the database and applied...