Jump to content

Recommended Posts

Posted

Index: java/net/sf/l2j/gameserver/model/GMAudit.java

===================================================================

--- java/net/sf/l2j/gameserver/model/GMAudit.java (revision 1933)

+++ java/net/sf/l2j/gameserver/model/GMAudit.java (working copy)

@@ -14,29 +14,50 @@

  */

package net.sf.l2j.gameserver.model;

 

+import java.io.File;

+import java.io.FileWriter;

+import java.io.IOException;

import java.text.SimpleDateFormat;

import java.util.Date;

import java.util.logging.Level;

import java.util.logging.Logger;

 

import net.sf.l2j.Config;

+import net.sf.l2j.gameserver.lib.Log;

 

-public class GMAudit {

- private static final Logger _log = Logger.getLogger("gmaudit");

-

- public static void auditGMAction(String gmName, String action, String target, String params){

- if (Config.GMAUDIT){

-            String today;

-            SimpleDateFormat formatter;

-            formatter = new SimpleDateFormat("dd/MM/yyyy H:mm:ss");

-            today = formatter.format(new Date());

-

- _log.log(Level.INFO, today + ">" + gmName + ">" + action + ">" +target + ">" + params);

+public class GMAudit

+{

+

+ private static final Logger _log = Logger.getLogger(Log.class.getName());

+

+ public static void auditGMAction(String gmName, String action, String target, String params)

+ {

+ if (Config.GMAUDIT)

+ {

+ new File("log/GMAudit").mkdirs();

+

+ SimpleDateFormat formatter;

+ formatter = new SimpleDateFormat("dd/MM/yyyy H:mm:ss");

+ String today = formatter.format(new Date());

+

+ try

+ {

+ File file = new File("log/GMAudit/" + gmName + ".txt");

+ FileWriter save = new FileWriter(file, true);

+

+ String out = (today + ">" + gmName + ">" + action + ">" + target + ">" + params + "\n");

+

+ save.write(out);

+ save.flush();

+ save.close();

+

+ save = null;

+ file = null;

+ }

+ catch (IOException e)

+ {

+ _log.log(Level.SEVERE, "GMAudit for GM " + gmName +" could not be saved: ", e);

+ }

}

}

-}

-

-

-

-

-

+}

\ No newline at end of file

 

creditos : Ahmed

Guest
This topic is now closed to further replies.
×
×
  • Create New...