for ( split(/:/,$type) ) { switch: { /syslog/ && do { # Print only to syslog here print "(type: $type | severity: $severity | msg: $msg)\n\n"; print SYSLOG "$severity - $msg"; last switch; }; /stdout/ && do { # Print only to stdout here print("$severity - $msg\n"); last switch; }; /stderr/ && do { # Print only to stderr here print STDERR "$severity - $msg\n"; last switch; }; /log/ && do { # Print to the log file here print LOG ×tamp . ": $severity - $msg\n"; last switch; }; /all/ && do { # Print to everything here (except stderr) for ( *STDOUT, *LOG, *SYSLOG ) { print $_ ×tamp . ": $severity - $msg ($_)\n"; } last switch; }; /allerr/ && do { # Print to everything here (except stdout) for ( *STDERR, *LOG, *SYSLOG ) { print $_ ×tamp . ": $severity - $msg ($_)\n"; } last switch; }; # This next line is simply for completeness. It will most likely # never get used because of the check in the beginning of this # sub. DEFAULT: { print LOG ×tamp . ": $severity - $msg\n"; print STDOUT "$severity - $msg\n" if ( $DEBUG == "1" ); # Print only to the log here }; } } close(SYSLOG); }