<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>blogadresse &#187; funktion</title>
	<atom:link href="http://blogadresse.de/tag/funktion/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogadresse.de</link>
	<description>Tech. Design. Notes. Nonsense.</description>
	<lastBuildDate>Tue, 22 May 2012 15:52:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>AppleScript Log-Funktion</title>
		<link>http://blogadresse.de/applescript-log-funktion/</link>
		<comments>http://blogadresse.de/applescript-log-funktion/#comments</comments>
		<pubDate>Mon, 19 May 2008 12:17:41 +0000</pubDate>
		<dc:creator>Jan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[funktion]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://www.blogadresse.de/?p=379</guid>
		<description><![CDATA[Ich habe oft Applescript, die sehr lange laufen und keine GUI haben, daher habe ich mir eine kleine Funktion geschrieben, die mir eine Logdatei im Log-Verzeichnis meines aktuell angemeldeten Benutzers schreibt (~/Library/Logs/). Aufgerufen wird die Funktion einfach mit â€œmy logger(my_log, &#8230; <a href="http://blogadresse.de/applescript-log-funktion/">Weiterlesen</a>]]></description>
			<content:encoded><![CDATA[<p>Ich habe oft Applescript, die sehr lange laufen und keine GUI haben, daher habe ich mir eine kleine Funktion geschrieben, die mir eine Logdatei im Log-Verzeichnis meines aktuell angemeldeten Benutzers schreibt (~/Library/Logs/).</p>
<p> <span id="more-379"></span></p>
<p>Aufgerufen wird die Funktion einfach mit â€œmy logger(my_log, myFile)â€ sobei my_log der String ist, der in die Logdatei geschrieben werden soll und myFile, der Dateiname des Logfiles. Die Funktion erstellt automatische eine entsprechende Datei im Log-Verzeichnis und f&#252;gt auch automatisch das aktuelle Datum inklusive Uhrzeit bei jedem Log-Befehl hinzu. Die Logsfiles k&#246;nnen mit jedem Textedior betrachtet werden oder nat&#252;rlich auch Konsole.app.</p>
<pre lang="applescript" line="1" colla="+">
on logger(my_log, myFile)
	set myPath to ((path to home folder as string) &#038; "Library:Logs")
	set myUnixPath to POSIX path of myPath
	try
		do shell script "touch " &#038; myUnixPath &#038; "/" &#038; myFile
	on error errMsg number errNum
		do shell script "mkdir " &#038; myUnixPath
		do shell script "echo ' ' > " &#038; myUnixPath &#038; "/" &#038; myFile
	end try
	set my_log_file to open for access file (myPath &#038; ":" &#038; myFile) with write permission -- this opens the file
	write (((current date) as string) &#038; " " &#038; my_log) to my_log_file starting at eof -- append to the end
	close access my_log_file -- close the file when you're done
end logger
</pre>
<pre lang="applescript" line="1" colla="+">
-- Dies ist ein Beispielaufruf
my logger("Ich habe grade blogadresse.de besucht", "Weblog.log")
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blogadresse.de/applescript-log-funktion/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

