Common.pm 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # This program is free software: you can redistribute it and/or modify
  2. # it under the terms of the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE
  3. #
  4. # You should have received a copy of the
  5. # COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
  6. # along with this program. If not, see http://www.sun.com/cddl/cddl.html
  7. #
  8. # 2022 https://://www.bananas-playground.net/projekt/aranea
  9. package Aranea::Common;
  10. use 5.20.0;
  11. use strict;
  12. use warnings;
  13. use utf8;
  14. use Term::ANSIColor qw(:constants);
  15. use DateTime;
  16. use Exporter qw(import);
  17. our @EXPORT_OK = qw(sayLog sayYellow sayGreen sayRed);
  18. sub sayLog {
  19. my ($string) = @_;
  20. my $dt = DateTime->now;
  21. say "[".$dt->datetime."] DEBUG: ".$string;
  22. }
  23. sub sayYellow {
  24. my ($string) = @_;
  25. my $dt = DateTime->now;
  26. say CLEAR,YELLOW, "[".$dt->datetime."] ".$string, RESET;
  27. }
  28. sub sayGreen {
  29. my ($string) = @_;
  30. my $dt = DateTime->now;
  31. say CLEAR,GREEN, "[".$dt->datetime."] ".$string, RESET;
  32. }
  33. sub sayRed {
  34. my ($string) = @_;
  35. my $dt = DateTime->now;
  36. say BOLD, RED, "[".$dt->datetime."] ".$string, RESET;
  37. }
  38. 1;