File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed
Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -15,4 +15,11 @@ public synchronized String getTime() {
1515 SimpleDateFormat sdf = new SimpleDateFormat ("HH:mm:ss" );
1616 return (sdf .format (cal .getTime ()));
1717 }
18+
19+ public synchronized String getTimeDate () {
20+ Calendar cal = Calendar .getInstance ();
21+ cal .getTime ();
22+ SimpleDateFormat sdf = new SimpleDateFormat ("E dd MMM Y HH:mm:ss" );
23+ return (sdf .format (cal .getTime ()));
24+ }
1825}
Original file line number Diff line number Diff line change @@ -10,10 +10,6 @@ public class PrintToLog {
1010 private static PrintWriter printer ;
1111 private File url ;
1212
13- public PrintToLog () {
14-
15- }
16-
1713 public PrintToLog (String url ) {
1814 this .url = new File (url );
1915 initiate ();
Original file line number Diff line number Diff line change @@ -34,14 +34,15 @@ private void printOut(){
3434 if (lineNumber == 0 ) {
3535
3636 String dashes = "" ;
37+ String title = ("[" + time .getTimeDate () + "]" );
3738 char dash = '-' ;
38- int number = 16 ;
39+ int number = title . length () / 3 ;
3940
4041 char [] repeat = new char [number ];
4142 Arrays .fill (repeat , dash );
4243 dashes += new String (repeat );
4344
44- logFile .log (dashes + msgTime + dashes + "\n " + msgTime + msgType + this .getMessage ());
45+ logFile .log (dashes + title + dashes + "\n " + msgTime + msgType + this .getMessage ());
4546 lineNumber ++;
4647 } else {
4748 logFile .log (msgTime + msgType + this .getMessage ());
You can’t perform that action at this time.
0 commit comments