/src/main/java/me/taylorkelly/bigbrother/BBLogging.java

https://github.com/gnftoxic/BigBrother · Java · 110 lines · 40 code · 13 blank · 57 comment · 2 complexity · c9441606c4c51da0ef2dcf47c91283cd MD5 · raw file

  1. /**
  2. * Logging interface
  3. * Copyright (C) 2011 BigBrother Contributors
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. package me.taylorkelly.bigbrother;
  19. import java.util.logging.Level;
  20. import java.util.logging.Logger;
  21. public class BBLogging {
  22. public static final Logger log = Logger.getLogger("Minecraft");
  23. /**
  24. * Log INFO-level messages with a minimum of cruft.
  25. *
  26. * @author N3X15
  27. */
  28. public static void info(String message, Throwable e) {
  29. log.log(Level.INFO, "[BBROTHER] " + message, e);
  30. }
  31. /**
  32. * Log WARNING-level messages with a minimum of cruft.
  33. *
  34. * @author N3X15
  35. */
  36. public static void warning(String message, Throwable e) {
  37. log.log(Level.WARNING, "[BBROTHER] " + message, e);
  38. }
  39. /**
  40. * Log SEVERE-level messages with a minimum of cruft.
  41. *
  42. * @author N3X15
  43. */
  44. public static void severe(String message, Throwable e) {
  45. log.log(Level.SEVERE, "[BBROTHER] " + message, e);
  46. }
  47. /**
  48. * Log FINE-level messages with a minimum of cruft.
  49. *
  50. * @author N3X15
  51. */
  52. public static void fine(String message, Throwable e) {
  53. log.log(Level.FINE, "[BBROTHER] " + message, e);
  54. }
  55. /**
  56. * Log INFO-level messages with a minimum of cruft.
  57. *
  58. * @author N3X15
  59. */
  60. public static void info(String message) {
  61. log.log(Level.INFO, "[BBROTHER] " + message);
  62. }
  63. /**
  64. * Log WARNING-level messages with a minimum of cruft.
  65. *
  66. * @author N3X15
  67. */
  68. public static void warning(String message) {
  69. log.log(Level.WARNING, "[BBROTHER] " + message);
  70. }
  71. /**
  72. * Log SEVERE-level messages with a minimum of cruft.
  73. *
  74. * @author N3X15
  75. */
  76. public static void severe(String message) {
  77. log.log(Level.SEVERE, "[BBROTHER] " + message);
  78. }
  79. /**
  80. * Log FINE-level messages with a minimum of cruft.
  81. *
  82. * @author N3X15
  83. */
  84. public static void fine(String message) {
  85. log.log(Level.FINE, "[BBROTHER] " + message);
  86. }
  87. public static void debug(String string) {
  88. if (BBSettings.debugMode) {
  89. log.log(Level.INFO, "[BBDEBUG] " + string);
  90. }
  91. }
  92. public static void debug(String string, Throwable e) {
  93. if (BBSettings.debugMode) {
  94. log.log(Level.INFO, "[BBDEBUG] " + string, e);
  95. }
  96. }
  97. }