Signed-off-by: Miroslav Lichvar <mlich...@redhat.com>
---
 phc2sys.8 | 7 +++++--
 phc2sys.c | 9 +++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/phc2sys.8 b/phc2sys.8
index 2559c74..2aa1455 100644
--- a/phc2sys.8
+++ b/phc2sys.8
@@ -207,12 +207,15 @@ Set the maximum syslog level of messages which should be 
printed or sent to
 the system logger. The default is 6 (LOG_INFO).
 .TP
 .BI \-t " message-tag"
-Specify the tag which is added to all messages printed to the standard output
-or system log. The default is an empty string.
+Specify the tag which is added to all messages printed to the standard output,
+log file, or system log. The default is an empty string.
 .TP
 .B \-m
 Print messages to the standard output.
 .TP
+.BI \-o " log-file"
+Print messages to the specified file.
+.TP
 .B \-q
 Don't send messages to the system logger.
 .TP
diff --git a/phc2sys.c b/phc2sys.c
index 5c54055..b320e91 100644
--- a/phc2sys.c
+++ b/phc2sys.c
@@ -1302,6 +1302,7 @@ static void usage(char *progname)
                " -l [num]       set the logging level to 'num' (6)\n"
                " -t [tag]       add tag to log messages\n"
                " -m             print messages to stdout\n"
+               " -o [path]      print messages to file\n"
                " -q             do not print messages to the syslog\n"
                " -v             prints the software version and exits\n"
                " -h             prints this message and exits\n"
@@ -1311,7 +1312,7 @@ static void usage(char *progname)
 
 int main(int argc, char *argv[])
 {
-       char *progname, *message_tag = NULL;
+       char *progname, *message_tag = NULL, *log_file = NULL;
        char *src_name = NULL, *dst_name = NULL;
        struct clock *src, *dst;
        struct config *cfg;
@@ -1343,7 +1344,7 @@ int main(int argc, char *argv[])
        progname = strrchr(argv[0], '/');
        progname = progname ? 1+progname : argv[0];
        while (EOF != (c = getopt(argc, argv,
-                                 
"arc:d:s:E:P:I:S:F:R:N:O:L:M:i:u:wn:xz:l:t:mqvh"))) {
+                                 
"arc:d:s:E:P:I:S:F:R:N:O:L:M:i:u:wn:xz:l:t:mo:qvh"))) {
                switch (c) {
                case 'a':
                        autocfg = 1;
@@ -1461,6 +1462,9 @@ int main(int argc, char *argv[])
                case 'm':
                        verbose = 1;
                        break;
+               case 'o':
+                       log_file = optarg;
+                       break;
                case 'q':
                        use_syslog = 0;
                        break;
@@ -1504,6 +1508,7 @@ int main(int argc, char *argv[])
        print_set_verbose(verbose);
        print_set_syslog(use_syslog);
        print_set_level(print_level);
+       print_set_logfile(log_file);
 
        if (autocfg) {
                if (init_pmc(cfg, &node, domain_number))
-- 
2.9.3


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to