本文整理汇总了Java中com.intellij.openapi.diagnostic.Logger类的典型用法代码示例。如果您正苦于以下问题:Java Logger类的具体用法?Java Logger怎么用?Java Logger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Logger类属于com.intellij.openapi.diagnostic包,在下文中一共展示了Logger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fillMaps
import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
private static void fillMaps() throws IOException {
Logger log = Logger.getInstance(UnsupportedFeaturesUtil.class.getName());
FileReader reader = new FileReader(PythonHelpersLocator.getHelperPath("/tools/versions.xml"));
try {
XMLReader xr = XMLReaderFactory.createXMLReader();
VersionsParser parser = new VersionsParser();
xr.setContentHandler(parser);
xr.parse(new InputSource(reader));
}
catch (SAXException e) {
log.error("Improperly formed \"versions.xml\". " + e.getMessage());
}
finally {
reader.close();
}
}
示例2: getBinary
import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
@NotNull
public static String getBinary(String envVar, String propVar, @NotNull String defaultBinary) {
Logger log = Logger.getInstance("ReasonML");
log.info("Identifying '" + defaultBinary + "' binary");
String binary = System.getProperty(propVar);
if (binary != null) {
log.info("Found '" + binary + "' in the property '" + propVar + "'");
return binary;
}
log.info("Property '" + envVar + "' not found, testing environment variable '" + propVar + "'");
binary = System.getenv(envVar);
if (binary != null) {
log.info("Found '" + binary + "' in the environment variable '" + envVar + "'");
return binary;
}
log.warn("No '" + defaultBinary + "' found in environment or properties, use default one");
return defaultBinary;
}
示例3: log
import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
public static void log(Logger logger, String title, String details, NotificationType level) {
switch (level) {
case ERROR:
logger.error(title, details);
break;
case WARNING:
logger.warn(title + "\n" + details);
break;
default:
logger.info(title + "\n" + details);
}
if (StringUtils.isBlank(details)) {
details = title;
}
Notifications.Bus.notify(EVENT_LOG_NOTIFIER.createNotification(title, details, level, null));
}
示例4: repoInfo
import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
public static RepoInfo repoInfo(String fileName) {
String fileRel = "";
String remoteURL = "";
String branch = "";
try{
// Determine repository root directory.
String fileDir = fileName.substring(0, fileName.lastIndexOf("/"));
String repoRoot = gitRootDir(fileDir);
// Determine file path, relative to repository root.
fileRel = fileName.substring(repoRoot.length()+1);
remoteURL = gitDefaultRemoteURL(repoRoot);
branch = gitBranch(repoRoot);
} catch (Exception err) {
Logger.getInstance(Util.class).info(err);
err.printStackTrace();
}
return new RepoInfo(fileRel, remoteURL, branch);
}
示例5: exec
import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
public static String exec(String cmd, String dir) throws IOException {
Logger.getInstance(Util.class).debug("exec cmd='" + cmd + "' dir="+dir);
// Create the process.
Process p = Runtime.getRuntime().exec(cmd, null, new File(dir));
BufferedReader stdout = new BufferedReader(new InputStreamReader(p.getInputStream()));
BufferedReader stderr = new BufferedReader(new InputStreamReader(p.getErrorStream()));
// Log any stderr ouput.
Logger logger = Logger.getInstance(Util.class);
String s;
while ((s = stderr.readLine()) != null) {
logger.debug(s);
}
String out = new String();
for (String l; (l = stdout.readLine()) != null; out += l + "\n");
return out;
}
示例6: applyFix
import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
public void applyFix(@NotNull Project project,
@NotNull ProblemDescriptor descriptor) {
final PsiElement problemElement = descriptor.getPsiElement();
if (problemElement == null || !problemElement.isValid()) {
return;
}
if (isQuickFixOnReadOnlyFile(problemElement)) {
return;
}
try {
doFix(project, descriptor);
} catch (IncorrectOperationException e) {
final Class<? extends LuaFix> aClass = getClass();
final String className = aClass.getName();
final Logger logger = Logger.getInstance(className);
logger.error(e);
}
}
示例7: invoke
import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
@Override
public void invoke(@NotNull Project project,
@NotNull PsiFile file,
Editor editor, @NotNull PsiElement startElement,
@NotNull PsiElement endElement) {
if (!FileModificationService.getInstance().prepareFileForWrite(file)) {
return;
}
try {
invokeImpl(project, file);
}
catch (IncorrectOperationException e) {
Logger.getInstance(getClass().getName()).error(e);
}
}
示例8: applyFix
import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
public final void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
final PsiElement problemElement = descriptor.getPsiElement();
if (problemElement == null || !problemElement.isValid()) {
return;
}
if (isQuickFixOnReadOnlyFile(problemElement)) {
return;
}
try {
doFix(project, problemElement);
}
catch (IncorrectOperationException e) {
final Class<? extends TitleCapitalizationFix> aClass = getClass();
final String className = aClass.getName();
final Logger logger = Logger.getInstance(className);
logger.error(e);
}
}
示例9: load
import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
@Override
public void load(@NotNull Consumer<String> consumer) {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(stream, CharsetToolkit.UTF8_CHARSET));
try {
String line;
while ((line = br.readLine()) != null) {
consumer.consume(line);
}
}
finally {
br.close();
}
}
catch (Exception e) {
Logger.getInstance(StreamLoader.class).error(e);
}
}
示例10: createComponent
import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
public final JComponent createComponent() {
if (myOptionsComponent == null){
myOptionsComponent = createOptionsPanel();
final JComponent component = createTopRightComponent();
if (component == null) {
myTopRightPanel.setVisible(false);
}
else {
myTopRightPanel.add(component, BorderLayout.CENTER);
}
}
if (myOptionsComponent != null) {
myOptionsPanel.add(myOptionsComponent, BorderLayout.CENTER);
}
else {
Logger.getInstance(getClass().getName()).error("Options component is null for "+getClass());
}
updateName();
return myWholePanel;
}
示例11: setInstalled
import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
public void setInstalled(@NotNull IDevice device, @NotNull File apk, @NotNull String pkgName) throws IOException {
String serial = device.getSerialNumber();
Map<String, InstallState> cache = myCache.get(serial);
if (cache == null) {
cache = Maps.newHashMap();
myCache.put(serial, cache);
}
String lastUpdateTime = getLastUpdateTime(device, pkgName);
if (lastUpdateTime == null) {
// set installed should be called only after the package has been installed
// If this error happens, look at the output of "dumpsys package <name>", and see why the parser did not identify the install state.
String msg = String.format("Unexpected error: package manager reports that package %1$s has not been installed: %2$s", pkgName,
StringUtil.notNullize(myDiagnosticOutput));
// We used to log an error, but see https://code.google.com/p/android/issues/detail?id=79778 for a case where this doesn't work
// on custom Android systems. So we just log a warning: the impact is that these users won't have any benefits of caching - the apk
// will always be uploaded
Logger.getInstance(InstalledApks.class).warn(msg);
return;
}
cache.put(pkgName, new InstallState(hash(apk), lastUpdateTime));
}
示例12: getRequiredFeatures
import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
@NotNull
public List<UsesFeature> getRequiredFeatures() {
final List<Manifest> manifests = getManifests();
if (manifests.isEmpty()) {
Logger.getInstance(ManifestInfo.class).warn("List of manifests is empty, possibly needs a gradle sync.");
}
return ApplicationManager.getApplication().runReadAction(new Computable<List<UsesFeature>>() {
@Override
public List<UsesFeature> compute() {
List<UsesFeature> usesFeatures = Lists.newArrayList();
for (Manifest m : manifests) {
usesFeatures.addAll(m.getUsesFeatures());
}
return usesFeatures;
}
});
}
示例13: syncIdeAndProjectAndroidNdk
import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
@VisibleForTesting
static void syncIdeAndProjectAndroidNdk(@NotNull final LocalProperties localProperties) {
File projectAndroidNdkPath = localProperties.getAndroidNdkPath();
File ideAndroidNdkPath = IdeSdks.getAndroidNdkPath();
if (projectAndroidNdkPath != null) {
if (!SdkPaths.validateAndroidNdk(projectAndroidNdkPath, false).success) {
if (ideAndroidNdkPath != null) {
Logger.getInstance(SdkSync.class).warn(String.format("Replacing invalid NDK path %1$s with %2$s",
projectAndroidNdkPath, ideAndroidNdkPath));
setProjectNdk(localProperties, ideAndroidNdkPath);
}
else {
Logger.getInstance(SdkSync.class).warn(String.format("Removing invalid NDK path: %s", projectAndroidNdkPath));
setProjectNdk(localProperties, null);
}
}
}
else {
setProjectNdk(localProperties, ideAndroidNdkPath);
}
}
示例14: initComponent
import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
@Override
@SuppressWarnings({"StringEquality"})
public void initComponent() {
final Language xmlLang = StdFileTypes.XML.getLanguage();
// intentionManager.addAction(new DeleteUnusedParameterFix());
// intentionManager.addAction(new DeleteUnusedVariableFix());
final XsltFormattingModelBuilder builder = new XsltFormattingModelBuilder(LanguageFormatting.INSTANCE.forLanguage(xmlLang));
LanguageFormatting.INSTANCE.addExplicitExtension(xmlLang, builder);
try {
// TODO: put this into com.intellij.refactoring.actions.IntroduceParameterAction, just like IntroduceVariableAction
ActionManager.getInstance().getAction("IntroduceParameter").setInjectedContext(true);
}
catch (Exception e) {
Logger.getInstance(XsltConfigImpl.class.getName()).error(e);
}
}
示例15: logAndClose
import com.intellij.openapi.diagnostic.Logger; //导入依赖的package包/类
public static void logAndClose(@NotNull Throwable error, @NotNull Logger log, @NotNull Channel channel) {
// don't report about errors while connecting
// WEB-7727
try {
if (error instanceof ConnectException) {
log.debug(error);
}
else {
log(error, log);
}
}
finally {
log.info("Channel will be closed due to error");
channel.close();
}
}