/** * Prints the message and flushes the output stream. * * @param message */ private static void displayMessage(String message, String methodName) { logger.log(MegaMek.class, methodName, LogLevel.INFO, message); }
/** * Write debug information to the logs. * * @param methodName Name of the method logging is coming from * @param message Message to log */ protected void logDebug(String methodName, String message) { getLogger().log(getClass(), methodName, LogLevel.DEBUG, message); }
/** * Designed to centralize output and logging. * Purely a pass-through to the version with a log level. * Default to log level 3. * * @param msg The message you want to log. * @deprecated Use {@link #getLogger()} instead. */ @Deprecated public static void logMessage(String msg) { getLogger().log(MekHQ.class, "unknown", LogLevel.INFO, msg); }
private void handleError(String methName, Throwable t, boolean quiet) { DefaultMmLogger.getInstance().log(getClass(), methName, LogLevel.ERROR, t); if (quiet) return; JOptionPane.showMessageDialog(this, t.getMessage(), "ERROR", JOptionPane.ERROR_MESSAGE); } }
/** * @deprecated Use {@link #getLogger()} instead. */ @Deprecated public static void logError(Exception ex) { getLogger().log(MekHQ.class, "unknown," + LogLevel.ERROR, ex); }
/** * @deprecated Use {@link #getLogger()} instead. */ @Deprecated public static void logError(String err) { getLogger().log(MekHQ.class, "unknown", LogLevel.ERROR, err); }
private static void debugLog(String msg, String methodName, Object... replacements) { if ((null != replacements) && (replacements.length > 0)) { msg = String.format(msg, replacements); } MekHQ.getLogger().log(MassRepairService.class, methodName, LogLevel.DEBUG, msg); }
private SharedConfiguration() { final MMLogger logger = DefaultMmLogger.getInstance(); try { InputStream is = new FileInputStream("mmconf/shared.properties"); properties.load(is); } catch (Exception e) { logger.log(SharedConfiguration.class, "SharedConfiguration()", LogLevel.ERROR, "Error trying to load shared.properties", e); } }
public void log(final Class<?> callingClass, final String methodName, final LogLevel level, final StringBuilder msg) { if (null == msg) { return; } log(callingClass, methodName, level, msg.toString()); }
/** * Designed to centralize output and logging. * * @param msg The message you want to log. * @param logLevel The log level of the message. * @deprecated Use {@link #getLogger()} instead. */ @Deprecated public static void logMessage(String msg, int logLevel) { getLogger().log(MekHQ.class, "unknown", verbosityToLogLevel(logLevel), msg); }
private void loadServices() { try { for (Iterator<T> iter = loader.iterator(); iter.hasNext(); ) { final T service = iter.next(); MekHQ.getLogger().log(getClass(), "loadServices()", LogLevel.DEBUG, "Found service " + service.getModuleName()); services.put(service.getModuleName(), service); } } catch (ServiceConfigurationError err) { MekHQ.getLogger().error(getClass(), "loadServices()", err); //$NON-NLS-1$ } }
private static void processFinances(Campaign retVal, Node wn) { MekHQ.getLogger().log(CampaignXmlParser.class, "processFinances(Campaign,Node)", LogLevel.INFO, //$NON-NLS-1$ "Loading Finances from XML..."); //$NON-NLS-1$ retVal.setFinances(Finances.generateInstanceFromXML(wn)); MekHQ.getLogger().log(CampaignXmlParser.class, "processFinances(Campaign,Node)", LogLevel.INFO, //$NON-NLS-1$ "Load of Finances complete!"); //$NON-NLS-1$ }
public void log(final Class<?> callingClass, final String methodName, final LogLevel level, final Throwable t) { getLogger().log(callingClass, methodName, level, t); }
public void addRoles(String str) { String[] fields = str.split(","); for (String role : fields) { MissionRole mr = MissionRole.parseRole(role); if (mr != null) { roles.add(mr); } else { DefaultMmLogger.getInstance().log(getClass(), "addRoles(String)", LogLevel.ERROR, "Could not parse mission role for " + getChassis() + " " + getModel() + ": " + role); } } }
public BotForce() { this.entityList = new ArrayList<Entity>(); try { behaviorSettings = BehaviorSettingsFactory.getInstance().DEFAULT_BEHAVIOR.getCopy(); } catch (PrincessException ex) { MekHQ.getLogger().log(getClass(), "BotForce()", LogLevel.ERROR, //$NON-NLS-1$ "Error getting Princess default behaviors"); //$NON-NLS-1$ MekHQ.getLogger().error(getClass(), "BotForce()", ex); //$NON-NLS-1$ } };
public int totalModelWeight(int era, String fKey) { FactionRecord fRec = RATGenerator.getInstance().getFaction(fKey); if (fRec == null) { DefaultMmLogger.getInstance().log(getClass(), "totalModelWeight(int, String)", LogLevel.WARNING, "Attempt to find totalModelWeight for non-existent faction " + fKey); return 0; } return totalModelWeight(era, fRec); }
private void ensurePersonIsRegistered(Person p) { Objects.requireNonNull(p); if (null == campaign.getPerson(p.getId())) { campaign.addPersonWithoutId(p, false); MekHQ.getLogger().log(Unit.class, "ensurePersonIsRegistered(Person)", LogLevel.WARNING, String.format("The person %s added this unit %s, was not in the campaign.", p.getName(), getName())); } }
@Override public List<GameEffect> genStressEffect(Campaign c, Person p, Injury i, int hits) { final String METHOD_NAME = "genStressEffect(Campaign,Person,Injury,int"; //$NON-NLS-1$ return Arrays.asList(new GameEffect( "20% chance of severing the spine, permanently paralizing the character", rnd -> { if(rnd.applyAsInt(100) < 20) { Injury severedSpine = SEVERED_SPINE.newInjury(c, p, BodyLocation.CHEST, 1); p.addInjury(severedSpine); MedicalLogEntry entry = MedicalLogger.severedSpine(p, c.getDate()); MekHQ.getLogger().log(getClass(), METHOD_NAME, LogLevel.INFO, entry.toString()); } })); }
private void addUnit(Unit u) { MekHQ.getLogger().log(getClass(), "addUnit()", LogLevel.INFO, //$NON-NLS-1$ "Adding unit: (" + u.getId() + "):" + u); //$NON-NLS-1$ units.put(u.getId(), u); checkDuplicateNamesDuringAdd(u.getEntity()); // Assign an entity ID to our new unit if (Entity.NONE == u.getEntity().getId()) { u.getEntity().setId(game.getNextEntityId()); } game.addEntity(u.getEntity().getId(), u.getEntity()); }
public void setTech(Person p) { if (null != tech) { MekHQ.getLogger().log(Unit.class, "setTech(Person)", LogLevel.WARNING, String.format("New tech assigned %s without removing previous tech %s", p.getName(), tech)); } ensurePersonIsRegistered(p); tech = p.getId(); p.addTechUnitID(getId()); ServiceLogger.assignedTo(p, campaign.getDate(), getName()); MekHQ.triggerEvent(new PersonTechAssignmentEvent(p, this)); }