    001package net.minecraft.logging;
    002
    003import cpw.mods.fml.common.FMLLog;
    004import cpw.mods.fml.relauncher.Side;
    005import cpw.mods.fml.relauncher.SideOnly;
    006import java.util.logging.ConsoleHandler;
    007import java.util.logging.FileHandler;
    008import java.util.logging.Handler;
    009import java.util.logging.Level;
    010import java.util.logging.Logger;
    011
    012public class LogAgent implements ILogAgent
    013{
    014    private final Logger field_98242_a;
    015    private final String field_98240_b;
    016    private final String field_98241_c;
    017    private final String field_98239_d;
    018
    019    public LogAgent(String par1Str, String par2Str, String par3Str)
    020    {
    021        this.field_98242_a = Logger.getLogger(par1Str);
    022        this.field_98241_c = par1Str;
    023        this.field_98239_d = par2Str;
    024        this.field_98240_b = par3Str;
    025        this.func_98238_b();
    026    }
    027
    028    private void func_98238_b()
    029    {
    030        this.field_98242_a.setParent(FMLLog.getLogger());
    031        Handler[] ahandler = this.field_98242_a.getHandlers();
    032        int i = ahandler.length;
    033
    034        for (int j = 0; j < i; ++j)
    035        {
    036            Handler handler = ahandler[j];
    037            this.field_98242_a.removeHandler(handler);
    038        }
    039
    040        LogFormatter logformatter = new LogFormatter(this, (LogAgentINNER1)null);
    041        try
    042        {
    043            FileHandler filehandler = new FileHandler(this.field_98240_b, true);
    044            filehandler.setFormatter(logformatter);
    045            this.field_98242_a.addHandler(filehandler);
    046        }
    047        catch (Exception exception)
    048        {
    049            this.field_98242_a.log(Level.WARNING, "Failed to log " + this.field_98241_c + " to " + this.field_98240_b, exception);
    050        }
    051    }
    052
    053    public void func_98233_a(String par1Str)
    054    {
    055        this.field_98242_a.log(Level.INFO, par1Str);
    056    }
    057
    058    @SideOnly(Side.SERVER)
    059    public Logger func_98076_a()
    060    {
    061        return this.field_98242_a;
    062    }
    063
    064    public void func_98236_b(String par1Str)
    065    {
    066        this.field_98242_a.log(Level.WARNING, par1Str);
    067    }
    068
    069    public void func_98231_b(String par1Str, Object ... par2ArrayOfObj)
    070    {
    071        this.field_98242_a.log(Level.WARNING, par1Str, par2ArrayOfObj);
    072    }
    073
    074    public void func_98235_b(String par1Str, Throwable par2Throwable)
    075    {
    076        this.field_98242_a.log(Level.WARNING, par1Str, par2Throwable);
    077    }
    078
    079    public void func_98232_c(String par1Str)
    080    {
    081        this.field_98242_a.log(Level.SEVERE, par1Str);
    082    }
    083
    084    public void func_98234_c(String par1Str, Throwable par2Throwable)
    085    {
    086        this.field_98242_a.log(Level.SEVERE, par1Str, par2Throwable);
    087    }
    088
    089    @SideOnly(Side.CLIENT)
    090    public void func_98230_d(String par1Str)
    091    {
    092        this.field_98242_a.log(Level.FINE, par1Str);
    093    }
    094
    095    static String func_98237_a(LogAgent par0LogAgent)
    096    {
    097        return par0LogAgent.field_98239_d;
    098    }
    099}