2

I have a program that uses err, errx, warn and warnx to alert the user about some unexpected events. Now I have to turn this program into a daemon, so these alerts should go to a well formated log.

I have redirected stdout and stderr to a file using freopen(3) but this does not provide enough information in the log. For instance I would need the date and time of the error.

Is there a convenient way of doing that using err(3) functions or should I drop the usage of these functions?

0

1 Answer 1

2

You might like to write wrappers to the functions in question. Those wrappers add the necessary info to the log message and then call the original functions internally.

On how to write a wrapper please read another answer of mine here and adopt the concept to your needs.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.