org.pmw.tinylog.Logger.error()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(210)

本文整理了Java中org.pmw.tinylog.Logger.error()方法的一些代码示例,展示了Logger.error()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.error()方法的具体详情如下:
包路径:org.pmw.tinylog.Logger
类名称:Logger
方法名:error

Logger.error介绍

暂无

代码示例

代码示例来源:origin: pingao777/markdown-preview-sync

  1. public static byte[] getBytes(String string) {
  2. try {
  3. return string.getBytes("UTF-8");
  4. } catch (UnsupportedEncodingException e) {
  5. Logger.error("Error occurs on get bytes of {}", string, e);
  6. }
  7. return new byte[0];
  8. }
  9. }

代码示例来源:origin: mattjlewis/diozero

  1. @Override
  2. public void exceptionCaught(ChannelHandlerContext context, Throwable cause) {
  3. Logger.error(cause, "exceptionCaught: {}", cause);
  4. context.close();
  5. }
  6. }

代码示例来源:origin: mathisdt/trackworktime

  1. @Override
  2. public int e(String tag, String msg) {
  3. Logger.error(msg);
  4. return Log.e(tag, msg);
  5. }
  6. @Override

代码示例来源:origin: pingao777/markdown-preview-sync

  1. public static byte[] readAllBytes(String path) {
  2. try {
  3. return Files.readAllBytes(Paths.get(path));
  4. } catch (IOException e) {
  5. Logger.error("Error occurs on reading byte of {}", path, e);
  6. }
  7. return new byte[0];
  8. }

代码示例来源:origin: pingao777/markdown-preview-sync

  1. public static String readAsString(String path) {
  2. try {
  3. return Files.lines(Paths.get(path), Charset.forName("UTF-8")).collect(Collectors.joining("\n"));
  4. } catch (Exception e) {
  5. Logger.error("Error occurs on reading content of {}", path, e);
  6. }
  7. return "";
  8. }

代码示例来源:origin: openpnp/openpnp

  1. public void setCommunicationsType(String communicationsType) {
  2. // If the communications type is changing we need to disconnect the old one first.
  3. if (communicationsType == null || !communicationsType.equals(this.communicationsType)) {
  4. try {
  5. disconnect();
  6. }
  7. catch (Exception e) {
  8. Logger.error(e);
  9. }
  10. }
  11. this.communicationsType = communicationsType;
  12. }

代码示例来源:origin: openpnp/openpnp

  1. public FluentCv saveDebugImage(Class implementationClass, String function, String identifier) {
  2. try {
  3. OpenCvUtils.saveDebugImage(implementationClass, function, identifier, mat);
  4. }
  5. catch (Exception e) {
  6. Logger.error(e, "Failed to save debug image.");
  7. }
  8. return this;
  9. }

代码示例来源:origin: mattjlewis/diozero

  1. public static void main(String[] args) {
  2. if (args.length < 1) {
  3. Logger.error("Usage: {} <mqtt-url>", MqttJsonServer.class.getName());
  4. System.exit(1);
  5. }
  6. try (MqttJsonServer mqtt_server = new MqttJsonServer(args[0])) {
  7. mqtt_server.start();
  8. } catch (UnknownHostException | MqttException e) {
  9. Logger.error(e, "Error: {}", e);
  10. }
  11. }

代码示例来源:origin: mathisdt/trackworktime

  1. public String getVersionName() {
  2. try {
  3. return context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
  4. } catch (PackageManager.NameNotFoundException nnfe) {
  5. Logger.error("could not get version name from manifest: {}", nnfe.getMessage());
  6. return "?";
  7. }
  8. }

代码示例来源:origin: mattjlewis/diozero

  1. public static void main(String[] args) {
  2. if (args.length < 1) {
  3. Logger.error("Usage: {} <MQTT-url>", MqttProtobufServer.class.getName());
  4. System.exit(1);
  5. }
  6. try (MqttTestClient mqtt_client = new MqttTestClient(args[0])) {
  7. mqtt_client.sendTestMessages(16);
  8. } catch (MqttException e) {
  9. Logger.error(e, "Error: {}", e);
  10. }
  11. }

代码示例来源:origin: mattjlewis/diozero

  1. @Override
  2. public void callback(int pin, boolean value, long epochTime, long nanoTime) {
  3. if (pin != gpio) {
  4. Logger.error("Error, got a callback for the wrong pin ({}), was expecting {}",
  5. Integer.valueOf(pin), Integer.valueOf(gpio));
  6. }
  7. valueChanged(new DigitalInputEvent(pin, epochTime, nanoTime, value));
  8. }
  9. }

代码示例来源:origin: mattjlewis/diozero

  1. @Override
  2. public void callback(int pin, boolean value, long epochTime, long nanoTime) {
  3. if (pin != gpio) {
  4. Logger.error("Error, got a callback for the wrong pin ({}), was expecting {}",
  5. Integer.valueOf(pin), Integer.valueOf(gpio));
  6. }
  7. valueChanged(new DigitalInputEvent(pin, epochTime, nanoTime, value));
  8. }
  9. }

代码示例来源:origin: mattjlewis/diozero

  1. boolean getValue(int gpio) {
  2. ResponseMessage response = sendMessage(new DigitalReadMessage(gpio));
  3. if (response == null) {
  4. return false;
  5. }
  6. // Validate GPIO returned matches that requested
  7. if (response.pinOrPort != gpio) {
  8. Logger.error("Returned GPIO ({}) doesn't match that requested ({})", Byte.valueOf(response.pinOrPort),
  9. Integer.valueOf(gpio));
  10. }
  11. return response.lsb != 0;
  12. }

代码示例来源:origin: mattjlewis/diozero

  1. private void sendMessage(Session session, Object o) {
  2. MessageWrapper wrapper = new MessageWrapper(o.getClass().getSimpleName(), GSON.toJson(o));
  3. try {
  4. session.getRemote().sendString(GSON.toJson(wrapper));
  5. } catch (IOException e) {
  6. Logger.error(e, "Error: {}", e);
  7. // TODO Cleanup this session?
  8. }
  9. }
  10. }

代码示例来源:origin: openpnp/openpnp

  1. public synchronized void disconnect() {
  2. connected = false;
  3. try {
  4. getCommunications().disconnect();
  5. }
  6. catch (Exception e) {
  7. Logger.error("disconnect()", e);
  8. }
  9. }

代码示例来源:origin: mattjlewis/diozero

  1. @Override
  2. public void valueChanged(DigitalInputEvent event) {
  3. MessageWrapper message = new MessageWrapper(event.getClass().getSimpleName(), GSON.toJson(event));
  4. sessions.forEach(session -> {
  5. try {
  6. session.getRemote().sendString(GSON.toJson(message));
  7. } catch (IOException e) {
  8. Logger.error(e, "Error: {}", e);
  9. // TODO Cleanup this session?
  10. }
  11. });
  12. }

代码示例来源:origin: mattjlewis/diozero

  1. @Override
  2. public void close() {
  3. try {
  4. mqttClient.disconnect();
  5. mqttClient.close();
  6. } catch (MqttException e) {
  7. Logger.error(e, "Error: {}", e);
  8. }
  9. }

代码示例来源:origin: pingao777/markdown-preview-sync

  1. public static void main(String[] args) {
  2. try {
  3. new SocketServer().start();
  4. } catch (Exception e) {
  5. Logger.error("Error occurs on socket server start", e);
  6. }
  7. }
  8. }

代码示例来源:origin: mathisdt/trackworktime

  1. public static File writeFile(String subDirectory, String fileNamePrefix, String fileNameSuffix, byte[] fileContent, Context context) {
  2. File targetDirectory = getDirectory(subDirectory, context);
  3. if (targetDirectory == null) {
  4. Logger.error("target {} is not writable", targetDirectory);
  5. return null;
  6. }
  7. String timeStamp = DateTimeUtil.getCurrentDateTime().format("YYYY-MM-DD-hh-mm-ss");
  8. String fileName = fileNamePrefix + "-generated-at-" + timeStamp + fileNameSuffix;
  9. File file = new File(targetDirectory, fileName);
  10. return writeFile(fileContent, file);
  11. }

代码示例来源:origin: mattjlewis/diozero

  1. @Override
  2. public void valueChanged(DigitalInputEvent event) {
  3. DiozeroProtos.Gpio.Notification notification = DiozeroProtosConverter.convert(event);
  4. try {
  5. mqttClient.publish(MqttProviderConstants.GPIO_NOTIFICATION_TOPIC, notification.toByteArray(),
  6. MqttProviderConstants.DEFAULT_QOS, MqttProviderConstants.DEFAULT_RETAINED);
  7. } catch (MqttException e) {
  8. Logger.error(e, "MQTT Error: {}", e);
  9. }
  10. }
  11. }

相关文章