Log.java 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package com.fujica.abk.utils;
  2. import ohos.hiviewdfx.HiLog;
  3. import ohos.hiviewdfx.HiLogLabel;
  4. public class Log {
  5. private static final HiLogLabel TAG = new HiLogLabel(HiLog.DEBUG, 0x0, "fspark log");
  6. public static void error(String message) {
  7. System.err.println("fspark log: " + message);
  8. }
  9. public static void error(Exception e) {
  10. System.err.println("fspark log: " + e.getMessage() != null ? e.getMessage() : e.toString());
  11. e.printStackTrace();
  12. }
  13. public static void error(Throwable e) {
  14. System.err.println("fspark log: " + e.getMessage() != null ? e.getMessage() : e.toString());
  15. e.printStackTrace();
  16. }
  17. public static void info(String message) {
  18. System.err.println("fspark log: " + message);
  19. }
  20. public static void warn(String message) {
  21. HiLog.warn(TAG, message);
  22. }
  23. // public static error(message: string | ESObject): void {
  24. // const msg: string = (message && typeof (message) == 'object') ? JSON.stringify(message) : (message || '').toString()
  25. // console.error(`fspark log:${msg}`);
  26. // }
  27. //
  28. // public static info(message: string | ESObject): void {
  29. // const msg: string = (message && typeof (message) == 'object') ? JSON.stringify(message) : (message || '').toString()
  30. // console.info(`fspark log:${msg}`);
  31. // }
  32. //
  33. // public static debug(message: string | ESObject): void {
  34. // const msg: string = (message && typeof (message) == 'object') ? JSON.stringify(message) : (message || '').toString()
  35. // console.debug(`fspark log:${msg}`);
  36. // }
  37. }