SciLifeLab/scilifelab — pull request #322 by guillermo-carrasco (2013-10-31 14:46:44+00:00)
Title: Script to log anything to Redis

This script allows us to log anything that produces some output to Redis. The DESCRIPTION string is quite descriptive I hope, some usage examples:

```
cat file.txt | stdin_to_redis -f cat
cat file.txt | stdin_to_redis -f '{"program":"cat", "file":"file.txt"}'
```

this will produce a record for each line in the file file.txt. The fields in the record depends on the -f parameter.

__Some important notes:__

_Why didn't you use argparse?_
This script is reading from stdin, if I use argparse, every line (and actually every word in the line) will be interpreted as a new command line argument, and the script will crash.

_There is a function called loadconfig() in scilifelab.utils that does exactly the same that this loadconfig() function, wouldn't be better to reuse it?_
I agree, but I didn't want to introduce a dependency to the whole scilifelab package just for this function. This script is probably going to be executed on servers where scilifelab is not installed, and it doesn't need to. On the other hand, the script is installed with the scilifelab package... which makes me think: wouldn't be better to move the utility scripts to another repository?