Write to Windows event log: Difference between revisions
Content added Content deleted
m (moved picolisp) |
Thundergnat (talk | contribs) (→{{header|Perl 6}}: Add a Perl 6 example) |
||
Line 487: | Line 487: | ||
$handle->Report($event); |
$handle->Report($event); |
||
</lang> |
</lang> |
||
=={{header|Perl 6}}== |
|||
{{works with|Rakudo|2020.01}} |
|||
There is not yet (that I am aware of) a native interface to the Windows logging functions, but Perl 6 can shell out and run a console command just as easily as most of these other languages. It ''does'' have a native interface to the syslog functions under POSIX environments though. |
|||
(Same caveats as the others, needs to be run as administrator or with elevated privileges under Windows.) |
|||
<lang perl6>given $*DISTRO { |
|||
when .is-win { |
|||
my $cmd = "eventcreate /T INFORMATION /ID 123 /D \"Bla de bla bla bla\""; |
|||
run($cmd); |
|||
} |
|||
default { # most POSIX environments |
|||
use Log::Syslog::Native; |
|||
my $logger = Log::Syslog::Native.new(facility => Log::Syslog::Native::User); |
|||
$logger.info("[$*PROGRAM-NAME pid=$*PID user=$*USER] Just thought you might like to know."); |
|||
} |
|||
}</lang> |
|||
=={{header|Phix}}== |
=={{header|Phix}}== |