Skip to content

[share]GM Log Enhancing

Featured Replies

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

useful one ! Thanks guma :P

Please stop sharing things like this >.>

Log code thats imba.. so imba ima lock it!

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.