-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hi all,

I'm trying to use LogP6 in one of my projects, but it's not working the
way I was expecting it to work. Presumably I'm overlooking something
simple, but I can't seem to figure out what or why. I have the
following code:


use App::CPAN::Repositories::Migration;
use Terminal::ANSIColor;
use LogP6 :configure;

unit module App::CPAN::Bin::Migrate;

filter(:name(''), :level($trace), :update);

constant Log = $?MODULE.^name.&get-logger;
constant MigrationRepo = App::CPAN::Repositories::Migration;

#| Undo the latest migration
multi sub MAIN (
  Bool:D :$down!
) is export {
  CATCH {
    when .message ~~ / "relation \"_migrations\" does not exist" / {
      $?MODULE.^name.&get-logger.warn("why have you forsaken me");
      dd Log;
      Log.warn("No migrations left to undo");
      exit 1
    }
  }

  my $last = MigrationRepo::last()<name>;

  MigrationRepo::down($last);

  say "Ran downgrade migration {color("bold")}{$last}{color("reset")}";
}


When running the program, I see the output "why have you forsaken me",
but not the output "No migrations left to undo". I added the `dd` call
to ensure that the `Log` constant is available, which it is. Why is the
log call of `Log.warn()` not being shown, but the
`$?MODULE.^name.&get-logger.warn()` is?

- -- 
With kind regards,

Patrick Spek


www:  https://www.tyil.nl/
mail: p.s...@tyil.nl
pgp:  1660 F6A2 DFA7 5347 322A  4DC0 7A6A C285 E2D9 8827

social: https://pleroma.tyil.nl/tyil
git:    https://git.tyil.nl/

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEtvaXdC78r18jzlHVAx1lkC6ECCEFAlzVKVEACgkQAx1lkC6E
CCGPbAf/ZirLlQvfS7bncgVdJ4tFKvtXVbPFMfCFRZqUQ5Zj48EnMR51K26hjDwy
5BJhXB8HNzAuwzf7jjqbyYiOkkq4vHhWcsDfhdQ2zdgtapApaCFliGoUbDKAQQRR
1iTXXlxY3P4JmBuTXw+uenFcI7eBhhNTn0SRfFtpqqEdtBKO3Oc3Ff9HQP1OTBoJ
QxTWCh/okYYnR8y+G4Od9aVNOpPOSChiEoeQ9ZjLNlT9ZjeoQSH5FPW/AbsFhqyM
zFp+7U5gWf0qy/3m4uKiKnIns3zz5ydGoZgA4P5mWAqDPGMfsqq2TRnlDm6mDu5A
qGn/ww/eC6kFK7sfn8sHxLZBiueobg==
=WLEV
-----END PGP SIGNATURE-----

Reply via email to