当前位置: 首页>>代码示例>>Java>>正文


Java Logger.warn方法代码示例

本文整理汇总了Java中org.pmw.tinylog.Logger.warn方法的典型用法代码示例。如果您正苦于以下问题:Java Logger.warn方法的具体用法?Java Logger.warn怎么用?Java Logger.warn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pmw.tinylog.Logger的用法示例。


在下文中一共展示了Logger.warn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
public static void main(String[] args) {

		// source coude generate level tag
		final String preLevelTag = "[[preLevelTag]]";
		final String postLevelTag = "[[postLevelTag]]";

		// for "1 default example" and "2 log-level decoration example" (see tinylog.properties) 
		Logger.trace("hello trace-world");
		Logger.debug("hello debug-world");
		Logger.info("hello info-world");
		Logger.warn("hello warn-world");
		//		Logger.warn("hello warn-world with {}source code generated{} 'misuse' of the level tag", preLevelTag, postLevelTag);
		Logger.error("hello error-world");


		// for "3 custom tag usage example" (see tinylog.properties)
		//		Logger.info("Example 1 - sequential tag replacement:   [[someCustomPreTag]] some text [[someCustomPostTag]] and possibly some other text");
		//		Logger.info("Example 2 - coloring of tag occurrence:   ----- pre-init (phase 1) ----- and possibly some other text");
		//		Logger.info("Example 3 - coloring within a tag:        <---- init (phase 2) ----> and possibly some other text");
		//		Logger.info("Example 4 - coloring of tagged content:   <==== init DONE ====> and possibly some other text");
		//		Logger.info("Example 5 - coloring or arbitrary strings: UNCAUGHT EXCEPTION: error in some class");
	}
 
开发者ID:tobiasrm,项目名称:tinylog-coloredconsole,代码行数:23,代码来源:Main.java

示例2: getArgs

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
private static String[] getArgs(final String[] cmdArgs) {
    final File argsFile = new File(ARGS_FILE_NAME);
    if (argsFile.canRead()) {
        try {
            final Scanner scanner = new Scanner(argsFile);
            final ArrayList<String> argsList = new ArrayList<>();
            while (scanner.hasNext()) {
                argsList.add(scanner.next());
            }
            scanner.close();
            Logger.info("Arguments loaded from file \"{}\"", ARGS_FILE_NAME);
            return argsList.toArray(new String[0]);
        } catch (final FileNotFoundException e) {
            Logger.warn(e, "Unable to load file \"{}\", using commandline arguments", ARGS_FILE_NAME);
            return cmdArgs;
        }
    } else {
        Logger.info("Using commandline arguments");
        return cmdArgs;
    }
}
 
开发者ID:dragonite-network,项目名称:dragonite-java,代码行数:22,代码来源:CLIMain.java

示例3: setShared

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
/**
 * populate the list of shared values from a given array
 */
public boolean setShared(List<String[]> shared){

    //iterate through list, adding
    ArrayList<String> lsSharedOptions = new ArrayList<String>();
    for(String[] line : shared){ //for each line in the shared file
        lsSharedOptions.add(line[0]); //option
        String[] toAdd = {line[0], line[1]};
        this.collection.lsShared.add(toAdd);

        Logger.trace("Added shared value '{}:{}'",line[0],line[1]);
    }

    //validate the set of shared values. if not validated, clear
    if(!isValidOptions(lsSharedOptions)){
        this.collection.lsShared.clear();
        Logger.warn("Collection-level warning: 'shared.csv' file is not accurately formatted or is empty");
        return false;
    }

    //already added
    return true;
}
 
开发者ID:lib-re,项目名称:dublin-core-text-parser,代码行数:26,代码来源:Parser.java

示例4: exportHar

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
private void exportHar() {
    TestResult result = getTestResult();
    if (result == null) {
        return;
    }

    String filePath = chooseFile(exportHarFileDialog, "Export HAR", FileDialog.SAVE);
    if (filePath != null) {
        try {
            HarWriter.save(result, filePath);
        } catch (Exception e) {
            Logger.warn(e, "Problem writing Http Archive file to {}", filePath);
            MessageDialog.show(MainWindow.this,
                String.format("File Not Saved: %s", e.getMessage()),
                "ERROR", JOptionPane.ERROR_MESSAGE);
        }
    }
}
 
开发者ID:loadtestgo,项目名称:pizzascript,代码行数:19,代码来源:MainWindow.java

示例5: onReceive

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
@Override
public void onReceive(I2CEvent event) {
	Logger.debug(event);
	Integer register = Integer.valueOf(event.getRegister());
	lock.lock();
	try {
		Condition condition = conditions.get(register);
		if (condition == null) {
			Logger.warn("Got an I2C event for a register ({}) not being monitored", register);
		} else {
			LinkedList<I2CEvent> event_queue = eventQueues.get(register);
			if (event_queue == null) {
				event_queue = new LinkedList<>();
				eventQueues.put(register, event_queue);
			}
			event_queue.addLast(event);
			condition.signalAll();
		}
	} finally {
		lock.unlock();
	}
	event.getRegister();
}
 
开发者ID:mattjlewis,项目名称:diozero,代码行数:24,代码来源:FirmataI2CDevice.java

示例6: FirmataDeviceFactory

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
public FirmataDeviceFactory() {
	Logger.warn("*** Do NOT use this device factory for servo control; not yet implemented!");
	
	String port_name = PropertyUtil.getProperty("FIRMATA_SERIAL_PORT", null);
	if (port_name == null) {
		throw new IllegalArgumentException("Error, FIRMATA_SERIAL_PORT not set");
	}
	ioDevice = new FirmataDevice(port_name);
	
	try {
		ioDevice.start();
		Logger.info("Waiting for Firmata device '" + port_name + "' to initialise");
		ioDevice.ensureInitializationIsDone();
		Logger.info("Firmata device '" + port_name + "' successfully initialised");
	} catch (IOException | InterruptedException e) {
		throw new RuntimeIOException(e);
	}
}
 
开发者ID:mattjlewis,项目名称:diozero,代码行数:19,代码来源:FirmataDeviceFactory.java

示例7: start

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
public void start() throws MqttException {
	// Subscribe
	Logger.debug("Subscribing...");
	mqttClient.subscribe(MqttProviderConstants.GPIO_REQUEST_TOPIC + "/+");
	mqttClient.subscribe(MqttProviderConstants.I2C_REQUEST_TOPIC + "/+");
	mqttClient.subscribe(MqttProviderConstants.SPI_REQUEST_TOPIC + "/+");
	Logger.debug("Subscribed");

	monitor = new Object();
	try {
		// Wait forever
		synchronized (monitor) {
			monitor.wait();
		}
	} catch (InterruptedException e) {
		Logger.warn(e, "Interrupted: {}", e);
	}
}
 
开发者ID:mattjlewis,项目名称:diozero,代码行数:19,代码来源:MqttJsonServer.java

示例8: createPwmOutputDevice

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
@Override
public PwmOutputDeviceInterface createPwmOutputDevice(String key, PinInfo pinInfo, int pwmFrequency,
		float initialValue) throws RuntimeIOException {
	int gpio = pinInfo.getDeviceNumber();
	PwmType pwm_type = PwmType.SOFTWARE;
	if (pinInfo instanceof PwmPinInfo) {
		pwm_type = PwmType.HARDWARE;
		// PWM frequency is shared across all PWM outputs when using hardware PWM
		if (pwmFrequency != boardPwmFrequency) {
			Logger.warn("Requested PWM frequency ({}) is different to that configured for the board ({})"
					+ "; using board value", Integer.valueOf(pwmFrequency), Integer.valueOf(boardPwmFrequency));
		}
	}

	return new WiringPiPwmOutputDevice(key, this, pwm_type,
			pwm_type == PwmType.HARDWARE ? hardwarePwmRange : calcSoftwarePwmRange(pwmFrequency), gpio, initialValue);
}
 
开发者ID:mattjlewis,项目名称:diozero,代码行数:18,代码来源:WiringPiDeviceFactory.java

示例9: analyze

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
private void analyze() {
    fieldCount = Utils.makeCollection(classDef.getFields()).size();
    for (DexBackedMethod dbm : classDef.getMethods()) {
        DexMethod dexMethod;
        try {
            dexMethod = new DexMethod(dbm, fullMethodSignatures);
            failedMethods += 1;
        } catch (Exception e) {
            Logger.warn("Failed to analyze method: " + ReferenceUtil.getMethodDescriptor(dbm) + "; skipping", e);
            continue;
        }
        String methodDescriptor = ReferenceUtil.getMethodDescriptor(dbm);
        String methodSignature = methodDescriptor.split("->", 2)[1];
        methodSignatureToMethod.put(methodSignature, dexMethod);

        Utils.rollUp(opCounts, dexMethod.getOpCounts());
        Utils.rollUp(apiCounts, dexMethod.getApiCounts());
        Utils.rollUp(stringReferenceCounts, dexMethod.getStringReferenceCounts());
        Utils.rollUp(fieldReferenceCounts, dexMethod.getFieldReferenceCounts());
        Utils.rollUp(methodAccessorCounts, dexMethod.getMethodAccessors());

        annotationCount += dexMethod.getAnnotationCount();
        registerCount += dexMethod.getRegisterCount();
        instructionCount += dexMethod.getInstructionCount();
        tryCatchCount += dexMethod.getTryCatchCount();
        debugItemCount += dexMethod.getDebugItemCount();
        cyclomaticComplexity += dexMethod.getCyclomaticComplexity();
    }
    if (!methodSignatureToMethod.isEmpty()) {
        cyclomaticComplexity /= methodSignatureToMethod.size();
    }
}
 
开发者ID:CalebFenton,项目名称:apkfile,代码行数:33,代码来源:DexClass.java

示例10: convertValueToInteger

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
private int convertValueToInteger(String value, int defaultValue) {
    if (value == null || value.isEmpty()) {
        return defaultValue;
    } else {
        try {
            return Integer.parseInt(value);
        } catch (NumberFormatException e) {
            Logger.warn(e);
            return defaultValue;
        }
    }
}
 
开发者ID:CalebFenton,项目名称:apkfile,代码行数:13,代码来源:XmlStartElementChunk.java

示例11: UnknownChunk

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
protected UnknownChunk(ByteBuffer buffer, @Nullable Chunk parent) throws IllegalArgumentException {
    super(buffer, parent);

    // If you're here, something went wrong!
    if (headerSize > chunkSize) {
        Logger.warn("Header size (" + headerSize + ") > chunk size (" + chunkSize + ")");
        header = new byte[0];
        payload = new byte[0];
        dummyChunkSize = Math.min(headerSize + chunkSize, buffer.remaining() + Chunk.METADATA_SIZE);
        return;
    }
    if (headerSize + chunkSize > buffer.remaining()) {
        Logger.warn("Chunk size (" + (headerSize + chunkSize) + ") greater than remaining buffer (" + buffer.remaining() + ")");
        header = new byte[0];
        payload = new byte[0];
        dummyChunkSize = Math.max(buffer.remaining(), Chunk.METADATA_SIZE);
        return;
    }
    if (headerSize == 0) {
        Logger.warn("Header size is 0, which is wrong");
        header = new byte[0];
        payload = new byte[0];
        dummyChunkSize = Chunk.METADATA_SIZE;
        return;
    }

    header = new byte[headerSize - Chunk.METADATA_SIZE];
    payload = new byte[chunkSize - headerSize];
    dummyChunkSize = chunkSize;
    buffer.get(header);
    buffer.get(payload);
}
 
开发者ID:CalebFenton,项目名称:apkfile,代码行数:33,代码来源:UnknownChunk.java

示例12: main

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
public static void main(String[] args) {
	List<W1ThermSensor> sensors = W1ThermSensor.getAvailableSensors();
	if (sensors.isEmpty()) {
		Logger.warn("No W1-therm sensors detected");
		return;
	}
	Logger.info("Detected " + sensors.size() + " sensors");
	test(sensors.get(0));
}
 
开发者ID:mattjlewis,项目名称:diozero,代码行数:10,代码来源:W1ThermSensorApp.java

示例13: mpu_get_compass_reg

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
/**
 * Read raw compass data.
 *  @return data		Raw data in hardware units.
 * @throws RuntimeIOException if an I/O error occurs
 */
public short[] mpu_get_compass_reg() throws RuntimeIOException {
	if ((sensors & INV_XYZ_COMPASS) == 0) {
		Logger.warn("mpu_get_compass_reg(), INV_XYZ_COMPASS not set in sensors");
		return null;
	}

	// raw_compass == 0x49 == MPU9150_RA_EXT_SENS_DATA_00
	byte[] tmp = i2cDevice.readBytes(MPU9150_RA_EXT_SENS_DATA_00, 8);
	/* AK8975 doesn't have the overrun error bit. */
	if ((tmp[0] & AKM_DATA_READY) == 0) {
		return null;
	}
	if (((tmp[7] & AKM_OVERFLOW) != 0) || ((tmp[7] & AKM_DATA_ERROR) != 0)) {
		return null;
	}
	
	short[] data = new short[3];
	// Note Little Endian!
	data[0] = (short)(((tmp[2] & 0xff) << 8) | (tmp[1] & 0xff));
	data[1] = (short)(((tmp[4] & 0xff) << 8) | (tmp[3] & 0xff));
	data[2] = (short)(((tmp[6] & 0xff) << 8) | (tmp[5] & 0xff));

	short[] mag_sens_adj = magSensor.get_mag_sens_adj();
	//System.out.format("mag_sens_adj=(%d, %d, %d)%n", mag_sens_adj[0], mag_sens_adj[1], mag_sens_adj[2]);
	// TODO Try to understand this...
	data[0] = (short)((data[0] * mag_sens_adj[0]) >> 8);
	data[1] = (short)((data[1] * mag_sens_adj[1]) >> 8);
	data[2] = (short)((data[2] * mag_sens_adj[2]) >> 8);

	return data;
}
 
开发者ID:mattjlewis,项目名称:diozero,代码行数:37,代码来源:MPU9150Driver.java

示例14: readWordData

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
@Override
public short readWordData(int registerAddress) {
	if ((funcs & NativeI2C.I2C_FUNC_SMBUS_READ_WORD_DATA) == 0) {
		Logger.warn("Function I2C_FUNC_SMBUS_READ_WORD_DATA isn't supported for device i2c-{}-0x{}",
				Integer.valueOf(controller), Integer.toHexString(deviceAddress));
		// TODO Throw an exception now or attempt anyway?
	}
	int rc = NativeI2C.readWordData(fd, registerAddress);
	if (rc < 0) {
		throw new RuntimeIOException("Error in SMBus.readWordData for device i2c-" + controller + "-0x"
				+ Integer.toHexString(deviceAddress) + ": " + rc);
	}

	return (short) rc;
}
 
开发者ID:mattjlewis,项目名称:diozero,代码行数:16,代码来源:NativeI2CDeviceSMBus.java

示例15: processCall

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
@Override
public short processCall(int registerAddress, short data) {
	if ((funcs & NativeI2C.I2C_FUNC_SMBUS_PROC_CALL) == 0) {
		Logger.warn("Function I2C_FUNC_SMBUS_PROC_CALL isn't supported for device i2c-{}-0x{}",
				Integer.valueOf(controller), Integer.toHexString(deviceAddress));
		// TODO Throw an exception now or attempt anyway?
	}
	int rc = NativeI2C.processCall(fd, registerAddress, data);
	if (rc < 0) {
		throw new RuntimeIOException("Error in SMBus.processCall for device i2c-" + controller + "-0x"
				+ Integer.toHexString(deviceAddress) + ": " + rc);
	}

	return (short) rc;
}
 
开发者ID:mattjlewis,项目名称:diozero,代码行数:16,代码来源:NativeI2CDeviceSMBus.java


注:本文中的org.pmw.tinylog.Logger.warn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。