[Slim-Checkins] r9389 - in /branches/6.5/server: Changelog6.html Slim/Utils/Misc.pm scanner.pl slimserver.pl

dsully at svn.slimdevices.com dsully at svn.slimdevices.com
Sun Sep 3 15:00:56 PDT 2006


Author: dsully
Date: Sun Sep  3 15:00:49 2006
New Revision: 9389

URL: http://svn.slimdevices.com?rev=9389&view=rev
Log:
Bug: 4033
Description: Merge from trunk -r 9387:9388

Modified:
    branches/6.5/server/Changelog6.html
    branches/6.5/server/Slim/Utils/Misc.pm
    branches/6.5/server/scanner.pl
    branches/6.5/server/slimserver.pl

Modified: branches/6.5/server/Changelog6.html
URL: http://svn.slimdevices.com/branches/6.5/server/Changelog6.html?rev=9389&r1=9388&r2=9389&view=diff
==============================================================================
--- branches/6.5/server/Changelog6.html (original)
+++ branches/6.5/server/Changelog6.html Sun Sep  3 15:00:49 2006
@@ -556,6 +556,7 @@
 		<li><a href="http://bugs.slimdevices.com/show_bug.cgi?id=4026">#4026</a> - WAV playback only works for 16 bits 44.1kHz</li>
 		<li><a href="http://bugs.slimdevices.com/show_bug.cgi?id=4030">#4030</a> - Add voltage to status command for transporter</li>
 		<li><a href="http://bugs.slimdevices.com/show_bug.cgi?id=4031">#4031</a> - Crash when enabling Network Health with no players</li>
+		<li><a href="http://bugs.slimdevices.com/show_bug.cgi?id=4033">#4033</a> - d_scan output in log.txt</li>
 		<li><a href="http://bugs.slimdevices.com/show_bug.cgi?id=4041">#4041</a> - Crasher updating player settings</li>
 	</ul>
 </ul>

Modified: branches/6.5/server/Slim/Utils/Misc.pm
URL: http://svn.slimdevices.com/branches/6.5/server/Slim/Utils/Misc.pm?rev=9389&r1=9388&r2=9389&view=diff
==============================================================================
--- branches/6.5/server/Slim/Utils/Misc.pm (original)
+++ branches/6.5/server/Slim/Utils/Misc.pm Sun Sep  3 15:00:49 2006
@@ -1080,6 +1080,32 @@
 	msg($msg);
 }
 
+=head2 openLogFile( $logfile )
+
+Opens a log file for writing in appending mode.
+
+=cut
+
+sub openLogFile {
+	my $logfile = shift || return;
+
+	my $logfilename = $logfile;
+
+	if (substr($logfile, 0, 1) ne "|") {
+		$logfilename = ">>" . $logfile;
+	}
+
+	if ($::stdio) {
+
+		open(STDERR, $logfilename) || die "Can't write to $logfilename: $!";
+
+	} else {
+
+		open(STDOUT, $logfilename) || die "Can't write to $logfilename: $!";
+		open(STDERR, '>&STDOUT')   || die "Can't dup stdout: $!";
+	}
+}
+
 =head2 msg( $entry, [ $forceLog ], [ $suppressTimestamp ])
 
 	Outputs an entry to the slimserver log file. 

Modified: branches/6.5/server/scanner.pl
URL: http://svn.slimdevices.com/branches/6.5/server/scanner.pl?rev=9389&r1=9388&r2=9389&view=diff
==============================================================================
--- branches/6.5/server/scanner.pl (original)
+++ branches/6.5/server/scanner.pl Sun Sep  3 15:00:49 2006
@@ -45,6 +45,7 @@
 	our ($d_startup, $d_info, $d_remotestream, $d_parse, $d_scan, $d_sql, $d_itunes, $d_server, $d_import, $d_moodlogic, $d_musicmagic);
 	our ($rescan, $playlists, $wipe, $itunes, $musicmagic, $moodlogic, $force, $cleanup, $prefsFile, $progress, $priority);
 
+	our $logfile;
 	our $LogTimestamp = 1;
 
 	GetOptions(
@@ -69,12 +70,17 @@
 		'prefsfile=s'  => \$prefsFile,
 		'progress'     => \$progress,
 		'priority=i'   => \$priority,
+		'logfile=s'    => \$logfile,
+		'LogTimestamp!'=> \$LogTimestamp,
 	);
 
 	if (!$rescan && !$wipe && !$playlists && !$musicmagic && !$moodlogic && !$itunes && !scalar @ARGV) {
 		usage();
 		exit;
 	}
+
+	# Open the log file, if any.
+	Slim::Utils::Misc::openLogFile($logfile);
 
 	# Bring up strings, database, etc.
 	initializeFrameworks();
@@ -273,6 +279,7 @@
 	--progress    Show a progress bar of the scan.
 	--prefsfile   Specify an alternate prefs file.
 	--priority    set process priority from -20 (high) to 20 (low)
+	--logfile     Send all debugging messages to the specified logfile.
 
 Debug flags:
 

Modified: branches/6.5/server/slimserver.pl
URL: http://svn.slimdevices.com/branches/6.5/server/slimserver.pl?rev=9389&r1=9388&r2=9389&view=diff
==============================================================================
--- branches/6.5/server/slimserver.pl (original)
+++ branches/6.5/server/slimserver.pl Sun Sep  3 15:00:49 2006
@@ -310,30 +310,12 @@
 
 		save_pid_file();
 
-		if (defined $logfile) {
-
-			my $logfilename = $logfile;
-
-			if (substr($logfile, 0, 1) ne "|") {
-				$logfilename = ">>" . $logfile;
-			}
-
-			if ($stdio) {
-
-				open(STDERR, $logfilename) || die "Can't write to $logfilename: $!";
-
-			} else {
-
-				open(STDOUT, $logfilename) || die "Can't write to $logfilename: $!";
-				open(STDERR, '>&STDOUT')   || die "Can't dup stdout: $!";
-			}
-		}
-	};
+		Slim::Utils::Misc::openLogFile($logfile);
+	}
 
 	# Change UID/GID after the pid & logfiles have been opened.
 	$::d_server && msg("SlimServer settings effective user and group if requested...\n");
 	changeEffectiveUserAndGroup();
-
 
 	# do platform specific environment setup
 	# we have some special directories under OSX.



More information about the checkins mailing list