]> jfr.im git - irc/thales.git/blob - src/log_worker.c
Added Linux-style inheritance implementation for workers.
[irc/thales.git] / src / log_worker.c
1 /* Log worker of GNU Thales. Copyright (C)
2 2012 Free Software Foundation, Inc. This file is part of GNU Thales.
3
4 GNU Thales is free software; you can redistribute it and/or modify it under the
5 terms of the GNU General Public License as published by the Free Software
6 Foundation; either version 3 of the License, or (at your option) any later
7 version.
8
9 GNU Make is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
13
14 You should have received a copy of the GNU General Public License along with
15 this program. If not, see <http://www.gnu.org/licenses/>. */
16 #include "log_worker.h"
17
18 static char *
19 log_worker_function(const char *msg, struct irc_meta *meta, void *config)
20 {
21 if (!config)
22 config = stdout;
23
24 fputs(msg, config);
25 }
26
27 struct worker*
28 create_log_worker(const struct envz *env)
29 {
30 struct log_options *inner_opts;
31 struct worker *worker;
32 const char *output_filename = envz_get(env->envz, env->envz_len, "output");
33 FILE *output_file = NULL;
34 if (output_filename && !(output_file = fopen(output_filename, "a"))) {
35 fprintf(stderr, "log worker: specified file `%s' can not be appended\n",
36 output_filename);
37 return NULL;
38 }
39
40 worker = xmalloc(sizeof *worker);
41 worker->config = output_file;
42
43 }