1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-12-14 04:00:30 +00:00

Use our global logger instead of per-class ones

No slf4j available for 1.16.5, and I'll forget if I depend on
log4j.
This commit is contained in:
Jonathan Coates 2022-10-23 16:13:08 +01:00
parent 3e3bc8d4b1
commit f4e542b4db
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
3 changed files with 6 additions and 15 deletions

View File

@ -6,13 +6,12 @@
package dan200.computercraft.data;
import com.google.gson.JsonElement;
import dan200.computercraft.ComputerCraft;
import net.minecraft.block.Block;
import net.minecraft.data.*;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.registries.ForgeRegistries;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import javax.annotation.Nonnull;
import java.nio.file.Path;
@ -32,8 +31,6 @@ import java.util.function.Supplier;
*/
public class ModelProvider implements IDataProvider
{
private static final Logger LOGGER = LogManager.getLogger();
private final DataGenerator generator;
private final Consumer<BlockModelProvider> blocks;
@ -97,7 +94,7 @@ public class ModelProvider implements IDataProvider
}
catch( Exception exception )
{
LOGGER.error( "Couldn't save {}", path, exception );
ComputerCraft.log.error( "Couldn't save {}", path, exception );
}
}
}

View File

@ -6,6 +6,7 @@
package dan200.computercraft.shared.computer.metrics;
import com.google.common.base.CaseFormat;
import dan200.computercraft.ComputerCraft;
import dan200.computercraft.core.metrics.Metric;
import dan200.computercraft.core.metrics.Metrics;
import dan200.computercraft.shared.computer.core.ServerComputer;
@ -15,8 +16,6 @@ import dan200.computercraft.shared.computer.metrics.basic.AggregatedMetric;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import net.minecraft.server.MinecraftServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import javax.management.*;
@ -33,8 +32,6 @@ import java.util.function.LongSupplier;
*/
public final class ComputerMBean implements DynamicMBean, ComputerMetricsObserver
{
private static final Logger LOGGER = LoggerFactory.getLogger( ComputerMBean.class );
private static @Nullable ComputerMBean instance;
private final Map<String, LongSupplier> attributes = new HashMap<>();
@ -66,7 +63,7 @@ public final class ComputerMBean implements DynamicMBean, ComputerMetricsObserve
catch( InstanceAlreadyExistsException | MBeanRegistrationException | NotCompliantMBeanException |
MalformedObjectNameException e )
{
LOGGER.warn( "Failed to register JMX bean", e );
ComputerCraft.log.warn( "Failed to register JMX bean", e );
}
}

View File

@ -5,6 +5,7 @@
*/
package dan200.computercraft.core.computer;
import dan200.computercraft.ComputerCraft;
import dan200.computercraft.core.lua.MachineResult;
import dan200.computercraft.support.ConcurrentHelpers;
import org.junit.jupiter.api.AfterEach;
@ -13,8 +14,6 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.api.parallel.Execution;
import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.TimeUnit;
@ -26,8 +25,6 @@ import static org.junit.jupiter.api.Assertions.*;
@Execution( ExecutionMode.CONCURRENT )
public class ComputerThreadTest
{
private static final Logger LOGGER = LoggerFactory.getLogger( ComputerThreadTest.class );
private FakeComputerManager manager;
@BeforeEach
@ -51,7 +48,7 @@ public class ComputerThreadTest
long delay = ConcurrentHelpers.waitUntil( timeout::isSoftAborted );
assertThat( "Should be soft aborted", delay * 1e-9, closeTo( 7, 0.5 ) );
LOGGER.info( "Slept for {}", delay );
ComputerCraft.log.info( "Slept for {}", delay );
computer.shutdown();
return MachineResult.OK;