Leaked source code of windows server 2003
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
@REM ----------------------------------------------------------------- @REM @REM logmsg.cmd - JeremyD @REM Logs text messages to the screen and/or in a log file @REM @REM Copyright (c) Microsoft Corporation. All rights reserved. @REM @REM ----------------------------------------------------------------- @perl -x "%~f0" %* @goto :EOF #!perl use strict; use lib $ENV{RAZZLETOOLPATH}; use ParseArgs; use Logmsg;
sub Usage { print<<USAGE; exit(1) } Prints the given string to the screen and into a file. Used by command scripts to log messages.
usage: logmsg.cmd < message | \@filename > [logfile]
/t If specified, the message is timestamped.
message Specifies the text to be logged, should be quoted.
filename A filename preceeded by an at-sign (\@) may be given instead of a message. The contents will be appened into the log if the given file exists.
logfile Specifies the name of the log file. LOGFILE, if defined, is the default. If this parameter is not specified and LOGFILE is not defined, the message is displayed on the screen only.
ex: call logmsg.cmd "This is the message to display." call logmsg.cmd \@mylog.txt
USAGE
my ($message, $logfile, $timestamp);
parseargs('?' => \&Usage, 't' => \$timestamp, \$message, \$logfile);
if ($logfile) { $ENV{LOGFILE} = $logfile; }
$ENV{SCRIPT_NAME} ||= '????';
# if the message starts with an @ interpret the rest as a filename to # append to the log if ($message =~ /^\@(.*)/) { if (-e $1) { append_file($1); } else { # do nothing if file to append does not exist } } # no initial @, message is just a string to be logged else { if ($timestamp) { timemsg($message); } else { logmsg($message); } }
|