Author: jerome
Date: 2008-12-09 16:31:40 +0100 (Tue, 09 Dec 2008)
New Revision: 3049
Added:
software_suite_v2/software/control_center/branches/new_paths/control_center/sources/com/tuxdroid/cc/Utils/Logger.java
Modified:
software_suite_v2/software/control_center/branches/new_paths/control_center/sources/com/tuxdroid/cc/CcCommons.java
software_suite_v2/software/control_center/branches/new_paths/control_center/sources/com/tuxdroid/cc/settings/Languages.java
Log:
* Added logger Object.
Modified:
software_suite_v2/software/control_center/branches/new_paths/control_center/sources/com/tuxdroid/cc/CcCommons.java
===================================================================
---
software_suite_v2/software/control_center/branches/new_paths/control_center/sources/com/tuxdroid/cc/CcCommons.java
2008-12-09 14:22:45 UTC (rev 3048)
+++
software_suite_v2/software/control_center/branches/new_paths/control_center/sources/com/tuxdroid/cc/CcCommons.java
2008-12-09 15:31:40 UTC (rev 3049)
@@ -25,6 +25,7 @@
import java.awt.Dimension;
import java.io.File;
+import java.io.IOException;
import java.util.Vector;
import javax.swing.ImageIcon;
@@ -34,6 +35,7 @@
import org.jdesktop.jdic.tray.TrayIcon;
+import com.tuxdroid.cc.Utils.Logger;
import com.tuxdroid.cc.Utils.Watcher;
import com.tuxdroid.cc.alerts.FiFo;
import com.tuxdroid.cc.control.CCRemoteActions;
@@ -103,8 +105,24 @@
public static String THEMEPACK_PATH =
InstallerPaths.tuxSkinlfThempack.getAbsolutePath();
+ public static Logger logger;
+
public static void initialize(){
-
+
+ MyTuxDirectory = new File(System.getProperty("user.home") +
File.separator + "MyTux");
+ TuxDroidSettingsDirectory = new
File(MyTuxDirectory.getAbsolutePath() + File.separator + "TuxDroidSettings");
+
+ //Initialize log file.
+ try
+ {
+ logger = new Logger();
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+
+ logger.append("Initializing locutors list", true);
//Initialize locutors list.
Locutors.add("bruno");
Locutors.add("julie");
@@ -124,20 +142,20 @@
Locutors.add("celia");
Locutors.add("erik");
Locutors.add("emma");
+ logger.appendDone();
//Fixed files.
- MyTuxDirectory = new File(System.getProperty("user.home") +
File.separator + "MyTux");
+
MyTuxGadgetsDirectory = new
File(MyTuxDirectory.getAbsolutePath() + File.separator + "MyTuxGadgets");
MyTuxAttitunesDirectory = new
File(MyTuxDirectory.getAbsolutePath() + File.separator + "MyTuxAttitunes");
MyTuxTools = new File(MyTuxDirectory.getAbsolutePath() +
File.separator + "MyTuxTools");
- TuxDroidSettingsDirectory = new
File(MyTuxDirectory.getAbsolutePath() + File.separator + "TuxDroidSettings");
TuxDroidSettingsFile = new
File(TuxDroidSettingsDirectory.getAbsolutePath() + File.separator +
"settings.xml");
TuxHelpFiles = InstallerPaths.directoryControlCenterHelps;
//Temporaries files.
GdgTempDirectory = new
File(System.getProperty("java.io.tmpdir") + File.separator + "MyTux/gdgTmp");
AttTempDirectory = new
File(System.getProperty("java.io.tmpdir") + File.separator +
"MyTux/tempDirectory");
- TgfGeneratorTemp = new
File(System.getProperty("java.io.tmpdir") + File.separator +
"MyTux/tgfGenerator");
+ TgfGeneratorTemp = new
File(System.getProperty("java.io.tmpdir") + File.separator +
"MyTux/tgfGenerator");
}
/**
Added:
software_suite_v2/software/control_center/branches/new_paths/control_center/sources/com/tuxdroid/cc/Utils/Logger.java
===================================================================
---
software_suite_v2/software/control_center/branches/new_paths/control_center/sources/com/tuxdroid/cc/Utils/Logger.java
(rev 0)
+++
software_suite_v2/software/control_center/branches/new_paths/control_center/sources/com/tuxdroid/cc/Utils/Logger.java
2008-12-09 15:31:40 UTC (rev 3049)
@@ -0,0 +1,124 @@
+/* This file is part of "TuxDroid Control Center".
+ * Copyright 2008, kysoh
+ * Author : Conan Jerome
+ * eMail : [EMAIL PROTECTED]
+ * Site : http://www.kysoh.com/
+ *
+ * "TuxDroid Control Center" is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * "TuxDroid Control Center" is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with "TuxDroid Control Center"; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package com.tuxdroid.cc.Utils;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Date;
+
+import com.tuxdroid.cc.CcCommons;
+
+public class Logger {
+
+ /** Log file **/
+ private File log;
+
+ public Logger() throws IOException
+ {
+ this.log = new
File(CcCommons.TuxDroidSettingsDirectory.getAbsolutePath() + File.separator +
"TuxDroidLog.txt");
+
+ //Deleting file if exists to be sure to have the latests logs.
+ if(log.exists())
+ {
+ log.delete();
+ }
+
+ log.createNewFile();
+ this.append("Control Center log file");
+ this.append("\n-----------------------------");
+ }
+
+
+ /**
+ * Append log file.
+ * @param text : text to log.
+ * @param goToNextLine : go to the line.
+ */
+ public void append(String text, boolean goToNextLine)
+ {
+ if(goToNextLine)
+ {
+ this.append("\n");
+ }
+
+ this.append(this.getTime() + text);
+ }
+
+
+
+ /**
+ * Append " --->> DONE " to the log file.
+ */
+ public void appendDone()
+ {
+ append(" --->> DONE ");
+ }
+
+
+ /**
+ * Return the log time.
+ * @return
+ */
+ private String getTime()
+ {
+ Date date = new Date();
+
+ return " [ " + date.toString() + " ] ";
+ }
+
+
+ /**
+ * Add some string to the log file.
+ * @param text
+ */
+ private void append(String text)
+ {
+ FileWriter writer = null;
+
+ try
+ {
+ writer = new FileWriter(this.log, true);
+ writer.write(text, 0, text.length());
+ }
+ catch(IOException ex)
+ {
+ ex.printStackTrace();
+ }
+ finally
+ {
+ if(writer != null)
+ {
+ try
+ {
+ writer.close();
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+}
Property changes on:
software_suite_v2/software/control_center/branches/new_paths/control_center/sources/com/tuxdroid/cc/Utils/Logger.java
___________________________________________________________________
Name: svn:executable
+ *
Modified:
software_suite_v2/software/control_center/branches/new_paths/control_center/sources/com/tuxdroid/cc/settings/Languages.java
===================================================================
---
software_suite_v2/software/control_center/branches/new_paths/control_center/sources/com/tuxdroid/cc/settings/Languages.java
2008-12-09 14:22:45 UTC (rev 3048)
+++
software_suite_v2/software/control_center/branches/new_paths/control_center/sources/com/tuxdroid/cc/settings/Languages.java
2008-12-09 15:31:40 UTC (rev 3049)
@@ -295,7 +295,7 @@
}
public String getAboutDevelopperCaption(){
- return this.get("aboutDevelopper", "Developper: Jrme Conan");
+ return this.get("aboutDevelopper", "Developper: Jerome Conan");
}
public String getAboutDevelopperMail(){
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn