org.modeshape.jcr.api.Logger.info()方法的使用及代码示例

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

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

Logger.info介绍

[英]Log a message at the INFO level according to the specified format and (optional) parameters. The message should contain a pair of empty curly braces for each of the parameter, which should be passed in the correct order. The pattern consists of zero or more keys of the form {n}, where n is an integer starting at 0. Therefore, the first parameter replaces all occurrences of "{0}", the second parameter replaces all occurrences of "{1}", etc.

If any parameter is null, the corresponding key is replaced with the string "null". Therefore, consider using an empty string when keys are to be removed altogether.
[中]根据指定的格式和(可选)参数在信息级别记录消息。消息应该为每个参数包含一对空大括号,并且应该按照正确的顺序传递。该模式由格式为{n}的零个或多个键组成,其中n是从0开始的整数。因此,第一个参数替换所有出现的“{0}”,第二个参数替换所有出现的“{1}”,等等。
如果任何参数为null,则相应的键将替换为字符串“null”。因此,当键被完全移除时,考虑使用一个空字符串。

代码示例

代码示例来源:origin: ModeShape/modeshape

doDelete(path, session);
} catch (NotFoundException e) {
  logger.info("Node at path {0} already deleted", path);

代码示例来源:origin: ModeShape/modeshape

private boolean processUsingAdvancedMetadata( Node imageNode,
                       Binary binaryValue,
                       boolean imageParsedUsingDefaultMetadata ) throws Exception {
  try (InputStream stream = binaryValue.getStream()) {
    Metadata advancedMetadata = ImageMetadataReader.readMetadata(new BufferedInputStream(stream), false);
    ExifIFD0Directory exifIFD0Directory = advancedMetadata.getDirectory(ExifIFD0Directory.class);
    if (exifIFD0Directory == null || !hasTags(exifIFD0Directory, EXIF_TAGS)) {
      if (!imageParsedUsingDefaultMetadata) {
        getLogger().info("Neither default nor advanced metadata parser can resolve image. Ignoring sequencing");
      }
      getLogger().debug("No relevant IFD0 information found, ignoring EXIF node.");
      return imageParsedUsingDefaultMetadata;
    }
    if (!imageParsedUsingDefaultMetadata) {
      //it's a format not supported by the default metadata and since we're reading the IFD0 descriptor, mark the image
      //as a TIFF
      getLogger().info(
          "Image has IFD0 block information but is not one of the standard image types, marking it as TIFF");
      imageNode.setProperty(ImageMetadataLexicon.FORMAT_NAME, TIFF_FORMAT);
      imageNode.setProperty(JcrConstants.JCR_MIME_TYPE, IMAGE_TIFF_DEFAULT_MIME_TYPE);
    }
    addEXIFNode(imageNode, exifIFD0Directory);
    return true;
  } catch (Exception e) {
    getLogger().debug(e, "Cannot process image for advanced metadata");
    return imageParsedUsingDefaultMetadata;
  }
}

代码示例来源:origin: org.modeshape/modeshape-sequencer-images

private boolean processUsingAdvancedMetadata( Node imageNode,
                       Binary binaryValue,
                       boolean imageParsedUsingDefaultMetadata ) throws Exception {
  try (InputStream stream = binaryValue.getStream()) {
    Metadata advancedMetadata = ImageMetadataReader.readMetadata(new BufferedInputStream(stream), false);
    ExifIFD0Directory exifIFD0Directory = advancedMetadata.getDirectory(ExifIFD0Directory.class);
    if (exifIFD0Directory == null || !hasTags(exifIFD0Directory, EXIF_TAGS)) {
      if (!imageParsedUsingDefaultMetadata) {
        getLogger().info("Neither default nor advanced metadata parser can resolve image. Ignoring sequencing");
      }
      getLogger().debug("No relevant IFD0 information found, ignoring EXIF node.");
      return imageParsedUsingDefaultMetadata;
    }
    if (!imageParsedUsingDefaultMetadata) {
      //it's a format not supported by the default metadata and since we're reading the IFD0 descriptor, mark the image
      //as a TIFF
      getLogger().info(
          "Image has IFD0 block information but is not one of the standard image types, marking it as TIFF");
      imageNode.setProperty(ImageMetadataLexicon.FORMAT_NAME, TIFF_FORMAT);
      imageNode.setProperty(JcrConstants.JCR_MIME_TYPE, IMAGE_TIFF_DEFAULT_MIME_TYPE);
    }
    addEXIFNode(imageNode, exifIFD0Directory);
    return true;
  } catch (Exception e) {
    getLogger().debug(e, "Cannot process image for advanced metadata");
    return imageParsedUsingDefaultMetadata;
  }
}

相关文章