Unfortunately, it appears to be lacking documentation. As to how to write the both kinds of log to the same file:
- Create a file handle by opening a file
- Pass it to the
logs
named arguments in the constructor (where it will be automatically used for errors too; you only need pass errors
if they should go to a separate file).
It will look something like:
my $logs = open "logs", :w;
my $logger = Cro::HTTP::Log::File.new(:$logs);
This can then be passed along to the Cro::HTTP::Server
's after
(which sets up the middleware to run on responses).
If using cro run
, note that it will automatically restart on changes to files within the directory where a .cro.yml
is present, and so can might end up getting a restart every time something is logged if the log file is in the same directory as the service. Add an ignore to deal with this.