diff options
author | Chris Wilson <chris+github@qwirx.com> | 2007-12-04 00:07:21 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2007-12-04 00:07:21 +0000 |
commit | 21598bc69144d139305ee49c6241d1ed411a2b44 (patch) | |
tree | 4fc59f1524125d6b7f2960572393f9eed34e9be5 /lib/server | |
parent | 03108275b3e189a1a4d6884cfd03012353b6fc7d (diff) |
Make ExtendedLogging use the logging framework so that we can view
the logs on the console along with other debug output.
Diffstat (limited to 'lib/server')
-rwxr-xr-x | lib/server/makeprotocol.pl.in | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/lib/server/makeprotocol.pl.in b/lib/server/makeprotocol.pl.in index f4561168..269ff3f5 100755 --- a/lib/server/makeprotocol.pl.in +++ b/lib/server/makeprotocol.pl.in @@ -503,11 +503,11 @@ __E if($implement_syslog) { - my ($format,$args) = make_log_strings($cmd); + my ($log) = make_log_strings_framework($cmd); print CPP <<__E; void ${class}LogSysLog(const char *Action) const { - ::syslog(LOG_INFO,"%s $format",Action$args); + BOX_TRACE($log); } __E } @@ -1004,4 +1004,45 @@ sub make_log_strings return ($cmd.'('.join(',',@str).')', join(',','',@arg)); } +sub make_log_strings_framework +{ + my ($cmd) = @_; + + my @args; + + for(my $x = 0; $x < $#{$cmd_contents{$cmd}}; $x+=2) + { + my ($ty,$nm) = (${$cmd_contents{$cmd}}[$x], ${$cmd_contents{$cmd}}[$x+1]); + + if(exists $log_display_types{$ty}) + { + # need to translate it + my ($format,$arg) = @{$log_display_types{$ty}}; + $arg =~ s/VAR/m$nm/g; + + if ($format =~ m'x$') + { + $arg = "std::hex << std::showbase " . + "<< $arg << std::dec"; + } + + push @args, $arg; + } + else + { + # is opaque + push @args, '"OPAQUE"'; + } + } + + my $log_cmd = "Action << \" $cmd(\" "; + foreach my $arg (@args) + { + $arg = "<< $arg "; + } + $log_cmd .= join('<< "," ',@args); + $log_cmd .= '<< ")"'; + return $log_cmd; +} + |