I am just starting to work with a logging library that anyone can use to track any system information while a user launches our application. The simplest example is to track information, warnings, and errors.
I want all plugins to be able to use this feature, but since each developer may have a different idea of what is important to communicate, I want to keep this as general as possible.
In the C ++ world, I would usually use something like stl::pair<string,string>, to act as the structure of a pair of key values and to have one stl::listof them to act as a "string" in the log. Then the cache log will be list<list<pair<string,string>>>(ugh!). Thus, developers can use the const string key, such as INFO, WARNING, ERROR, to sequentially name a column in a database (to select certain types of information).
I would like the database to be able to handle any number of different column names. For example, John might have an INFO row with a USER column, and Bill might have an INFO row with a FILENAME column. I want the log viewer to be able to display all the information, and if one report does not matter for INFO / FILENAME, these fields should be just empty. Thus, one of the options is to use List<List<KeyValuePair<String,String>>>, and the other is for the consumer of the journal library to somehow “register” his scheme, and then create a database ALTER TABLEto handle this situation. Another idea is to have a table intended only for key value pairs, with a foreign key that maps the key value pairs to the original log entry.
, , , , -, ( ), .
:
- - ? , - - , ?
- .NETish ,
List<List<KeyValuePair<String,String>>>? - # 2 , ALTER TABLE, Bad Thing?
- ? , , . , , , .