0.8
Sorting media using crowdsourcing.   
Doxygen
LIRIS
Public Member Functions | Package Attributes

myShell.LogWriter Class Reference

It is used to write a log file explaining the steps the program went through during its execution. More...

List of all members.

Public Member Functions

 LogWriter ()
 Creates an instance of LogWriter and writes the current date in it. <../..>
void append (String line)
 Appends the String "line" at the end of the log file and prints it on the screen. <../..>
void finish ()
 Writes the finishing time in the log file. <../..>

Package Attributes

String logName
 The name of the written file. <../..>

Detailed Description

It is used to write a log file explaining the steps the program went through during its execution.

Author:
Leo PERRIN (perrin.leo@gmail.com)

Definition at line 13 of file LogWriter.java.


Constructor & Destructor Documentation

myShell.LogWriter.LogWriter ( )

Creates an instance of LogWriter and writes the current date in it.

Definition at line 32 of file LogWriter.java.

      {
            Calendar cal = Calendar.getInstance();
            String date = cal.get(Calendar.DATE) + "-" + (cal.get(Calendar.MONTH)+1) + "-" +
                        cal.get(Calendar.YEAR) + "-(" +     cal.get(Calendar.HOUR_OF_DAY) + ":" +
                        cal.get(Calendar.MINUTE) + ":" + cal.get(Calendar.SECOND) + ")";
            this.logName = "../data/log/" + date + ".log" ;
            this.append(" ----- started at : " + date + "\n\n");
      }

Member Function Documentation

void myShell.LogWriter.append ( String  line)

Appends the String "line" at the end of the log file and prints it on the screen.

Parameters:
lineThe line to be appended in the file.

Definition at line 51 of file LogWriter.java.

      {
            System.out.println(line);
            try
            {
                  BufferedWriter logFile = new BufferedWriter
                              (new FileWriter(this.logName,true));
                  logFile.write(line);
                  logFile.newLine();
                  logFile.close();
            }
            catch (Exception e) { e.printStackTrace(); }
      }
void myShell.LogWriter.finish ( )

Writes the finishing time in the log file.

Definition at line 69 of file LogWriter.java.

      {
            Calendar cal = Calendar.getInstance();
            String date = cal.get(Calendar.DATE) + "-" + (cal.get(Calendar.MONTH)+1) + "-" +
                        cal.get(Calendar.YEAR) + "-(" +     cal.get(Calendar.HOUR_OF_DAY) + ":" +
                        cal.get(Calendar.MINUTE) + ":" + cal.get(Calendar.SECOND) + ")";
            append("\n ----- finished at : " + date);
      }

Member Data Documentation

String myShell.LogWriter.logName [package]

The name of the written file.

Definition at line 22 of file LogWriter.java.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables