/eclipse-plugin/plugins/com.google.test.metric.eclipse.core/src/main/java/com/google/test/metric/eclipse/internal/util/Logger.java

http://testability-explorer.googlecode.com/ · Java · 39 lines · 12 code · 4 blank · 23 comment · 0 complexity · d9e49c18b8b12ccc262645801542cabc MD5 · raw file

  1. /*
  2. * Copyright 2009 Google Inc.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.google.test.metric.eclipse.internal.util;
  17. import com.google.test.metric.eclipse.core.plugin.Activator;
  18. import org.eclipse.core.runtime.Status;
  19. /**
  20. * Utility class providing integration with Eclipse's logging framework.
  21. * <p>
  22. * Exceptions logged this way will show up in the Error log view.
  23. *
  24. * @author klundberg@google.com (Karin Lundberg)
  25. *
  26. */
  27. public class Logger {
  28. public void logException(String msg, Throwable e) {
  29. Activator.getDefault().getLog().log(new Status(Status.ERROR, Activator.PLUGIN_ID, msg, e));
  30. }
  31. public void logException(Throwable e) {
  32. Activator.getDefault().getLog().log(
  33. new Status(Status.ERROR, Activator.PLUGIN_ID, e.getMessage(), e));
  34. }
  35. }