Log-Dispatchouli-3.007/000755 000765 000024 00000000000 14474750275 015014 5ustar00rjbsstaff000000 000000 Log-Dispatchouli-3.007/LICENSE000644 000765 000024 00000046435 14474750275 016035 0ustar00rjbsstaff000000 000000 This software is copyright (c) 2023 by Ricardo SIGNES. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2023 by Ricardo SIGNES. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Perl Artistic License 1.0 --- This software is Copyright (c) 2023 by Ricardo SIGNES. This is free software, licensed under: The Perl Artistic License 1.0 The "Artistic License" Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder as specified below. "Copyright Holder" is whoever is named in the copyright or copyrights for the package. "You" is you, if you're thinking about copying or distributing this Package. "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as uunet.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) give non-standard executables non-standard names, and clearly document the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. You may embed this Package's interpreter within an executable of yours (by linking); this shall be construed as a mere form of aggregation, provided that the complete Standard Version of the interpreter is so embedded. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whoever generated them, and may be sold commercially, and may be aggregated with this Package. If such scripts or library files are aggregated with this Package via the so-called "undump" or "unexec" methods of producing a binary executable image, then distribution of such an image shall neither be construed as a distribution of this Package nor shall it fall under the restrictions of Paragraphs 3 and 4, provided that you do not represent such an executable image as a Standard Version of this Package. 7. C subroutines (or comparably compiled subroutines in other languages) supplied by you and linked into this Package in order to emulate subroutines and variables of the language defined by this Package shall not be considered part of this Package, but are the equivalent of input as in Paragraph 6, provided these subroutines do not change the language in any way that would cause it to fail the regression tests for the language. 8. Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package. 9. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End Log-Dispatchouli-3.007/Changes000644 000765 000024 00000016400 14474750275 016310 0ustar00rjbsstaff000000 000000 Revision history for Log-Dispatchouli 3.007 2023-09-02 20:18:04-04:00 America/New_York - add the is_X methods to Proxy as they were on the root logger (thanks, Charlie Garrison) - in Log::Fmt tests, cope with the slightly different output of JSON::PP versus the XS implementations 3.006 2023-08-11 10:58:09-04:00 America/New_York - fix a bug in Log::Fmt where an event data value that was a reference to a reference to an array was logged as its 0th element, not a flogged array reference 3.005 2023-06-08 20:41:02-04:00 America/New_York - add parse_event_string_as_hash, which loses duplicate k/v pairs but makes life a little easier 3.004 2023-06-05 21:26:03-04:00 America/New_York - optimization to parsing of quoted strings (thanks, Rob Mueller) 3.003 2023-06-05 08:10:52-04:00 America/New_York - Log::Fmt will now flog ref-refs, meaning you can easily log JSON as log event values 3.002 2022-12-06 09:49:34-05:00 America/New_York - restore v5.20 compatibility by turning on "postderef" feature explicitly 3.001 2022-12-01 11:55:43-05:00 America/New_York - no changes, just stable 3.000 2022-11-03 21:29:21-04:00 America/New_York (TRIAL RELEASE) - Log::Dispatchouli now requires v5.20, for pair slices - structured event logging with ->log_event -- read the docs, and Log::Fmt 2.023 2021-06-18 21:52:17-04:00 America/New_York - update author contact info - add perl-support section 2.022 2020-08-24 13:50:15-04:00 America/New_York - don't duplicate pid in syslog! 2.021 2020-08-12 11:48:57-04:00 America/New_York - add another experimental means to replace how Syslog output is set up 2.020 2020-02-06 13:45:44-05:00 America/New_York (TRIAL RELEASE) - add stdio_dispatcher_class, so you can subclass the Screen dispatcher for stderr and stdio; this is experimental! 2.019 2019-07-27 16:13:30-04:00 America/New_York - fix an initialization ordering bug for loggers using stdio 2.018 2019-07-26 18:36:56-04:00 America/New_York - add enable_stdout and enable_stderr to, uh, enable stdout and enable stderr (after initial construction) 2.017 2019-03-12 21:10:26-04:00 America/New_York - syslog_socket can now be supplied to replace the native socket for Sys::Syslog (thanks, Jon Stuart!) 2.016 2018-02-21 12:47:46-05:00 America/New_York - the Proxy logger now respects the same overloading as the root logger - muted works as a constructor argument (thanks, Dan Book) 2.015 2016-10-17 15:42:54-04:00 America/New_York - Log::Dispatchouli subclass can now provide its own proxy_class method to use something other than Log::Dispatchouli::Proxy 2.014 2016-10-14 18:28:36-04:00 America/New_York - non-trial release of v2.013 2.013 2016-07-30 16:34:57-04:00 America/New_York (TRIAL RELEASE) - minor optimizations to callbacks (thanks, Olivier Mengué) 2.012 2014-11-30 08:49:01-05:00 America/New_York avoid a newly-introduced warning on older perls (thanks, Christopher J. Madsen) 2.011 2014-11-29 08:50:45-05:00 America/New_York some optimizations in timestamp and pid logging (thanks, Olivier Mengué) 2.010 2014-07-28 22:24:23-04:00 America/New_York add the file_format option (thanks, Randy Stauner) 2.009 2014-01-11 14:14:11-05:00 America/New_York load the Proxy class earlier, to get it loaded prefork 2.008 2013-09-26 20:39:11 America/New_York fix test for JSON::PP, which doesn't always follow orders about spaces! (thanks, Dagfinn Ilmari Mannsåker!) 2.007 2013-09-25 22:12:22 America/New_York doc fixes and tests (thanks George Hartzell and Randy Stauner) 2.006 2013-04-05 15:02:05 America/New_York put the ->info, ->fatal, ->debug methods on proxies, too (thanks George Hartzell) 2.005 2011-04-07 23:16:40 America/New_York add log_file and log_path options 2.004 2011-01-21 15:52:41 America/New_York BUG FIX: it is okay to replace the default logger, always 2.003 2011-01-21 13:14:43 America/New_York add config_id to allow faking Global equality when testing 2.002 2011-01-14 17:51:16 America/New_York add env_value and env_prefix methods 2.001 2011-01-13 12:45:05 America/New_York greatly expanded tests and documentation for L::D::Global L::D now has "string_flogger" method to provide an alternate flogger 2.000 2010-11-23 18:48:53 America/New_York 1.102350 2010-08-23 08:55:17 America/New_York fix a bug in generating tempdirs for file logging (thanks, Sawyer X) 1.102220 2010-08-10 11:09:30 America/New_York added logger muting (mute, unmute, clear_muted, etc.) new_tester turns off log_pid by default internal simplification of Proxy 1.100712 2010-03-12 21:43:13 America/New_York add the quiet_fatal argument to suppress apparent double-logging to standard output and error streams 1.100711 2010-03-12 18:11:41 America/New_York 1.100710 2010-03-12 09:51:32 America/New_York add the Log::Dispatchouli::Proxy system get_prefix now always returns a scalar (undef, not ()) 1.100691 2010-03-10 17:10:53 America/New_York just like 1.100690, but passes its own tests! 1.100690 2010-03-10 14:24:59 America/New_York remove obsolete "list_name" alias to prefix object-level prefix no longer automatically ends in ": " 1.100681 2010-03-09 23:02:11 America/New_York rerelease with a tarball that isn't totally insane 1.100680 2010-03-09 22:47:23 America/New_York rewrite all log_ methods in terms of ->log ->log now includes the code formerly in the internal ->_log_at add a new per-message prefix system old-style prefix (to be removed) now handle multi-line messages * new prefix system is not yet documented, pending experimentation 1.100670 2010-03-08 19:15:30 America/New_York make env vars in code match env vars in docs 1.100660 2010-03-07 22:00:58 America/New_York add clear_events method loggers made with new_tester log to_self 1.100630 2010-03-04 18:41:13 America/New_York some more docs switch to Dist::Zilla for dist maintenance declare some previously missing prereqs 1.008 2010-02-22 ->fatal now redispatches to ->log_fatal 1.007 2010-02-22 ** THIS BREAKS BACKCOMPAT IN A TINY WAY ** ->debug now means ->log_debug ->is_debug and ->set_debug replace the old ->debug ->log_info is replaced by ->info 1.006 2010-02-21 add is_debug, is_info, is_fatal log_fatal logs as 'error' level change the way the undocumented "prefix" system works 1.005 2010-02-12 make Makefile.PL prereq match actual required versions 1.004 2010-02-10 allow multiple arguments to ->log and friends allow user to disable logging of pid 1.003 2009-01-15 relax a test that was complaining for no good reason Log-Dispatchouli-3.007/MANIFEST000644 000765 000024 00000001005 14474750275 016141 0ustar00rjbsstaff000000 000000 # This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.030. Changes LICENSE MANIFEST META.json META.yml Makefile.PL README dist.ini lib/Log/Dispatchouli.pm lib/Log/Dispatchouli/Global.pm lib/Log/Dispatchouli/Proxy.pm lib/Log/Fmt.pm t/00-report-prereqs.dd t/00-report-prereqs.t t/basic.t t/env-value.t t/events.t t/file.t t/global-subclass.t t/global.t t/lib/DDR/Child.pm t/lib/DDR/Parent.pm t/lib/SDR/Child.pm t/lib/SDR/Parent.pm t/proxy.t xt/author/pod-syntax.t xt/release/changes_has_content.t Log-Dispatchouli-3.007/t/000755 000765 000024 00000000000 14474750275 015257 5ustar00rjbsstaff000000 000000 Log-Dispatchouli-3.007/xt/000755 000765 000024 00000000000 14474750275 015447 5ustar00rjbsstaff000000 000000 Log-Dispatchouli-3.007/README000644 000765 000024 00000000571 14474750275 015677 0ustar00rjbsstaff000000 000000 This archive contains the distribution Log-Dispatchouli, version 3.007: a simple wrapper around Log::Dispatch This software is copyright (c) 2023 by Ricardo SIGNES. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. This README file was generated by Dist::Zilla::Plugin::Readme v6.030. Log-Dispatchouli-3.007/META.yml000644 000765 000024 00000031351 14474750275 016270 0ustar00rjbsstaff000000 000000 --- abstract: 'a simple wrapper around Log::Dispatch' author: - 'Ricardo SIGNES ' build_requires: ExtUtils::MakeMaker: '0' File::Spec: '0' File::Spec::Functions: '0' File::Temp: '0' JSON::MaybeXS: '0' Test::Deep: '0' Test::Fatal: '0' Test::More: '0.96' base: '0' lib: '0' utf8: '0' configure_requires: ExtUtils::MakeMaker: '6.78' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.030, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Log-Dispatchouli requires: Carp: '0' File::Spec: '0' Log::Dispatch: '0' Log::Dispatch::Array: '0' Log::Dispatch::File: '0' Log::Dispatch::Screen: '0' Log::Dispatch::Syslog: '0' Params::Util: '0' Scalar::Util: '0' String::Flogger: '0' Sub::Exporter: '0' Sub::Exporter::GlobExporter: '0.002' Sys::Syslog: '0.16' Try::Tiny: '0.04' experimental: '0' overload: '0' perl: v5.20.0 strict: '0' warnings: '0' resources: bugtracker: https://github.com/rjbs/Log-Dispatchouli/issues homepage: https://github.com/rjbs/Log-Dispatchouli repository: https://github.com/rjbs/Log-Dispatchouli.git version: '3.007' x_Dist_Zilla: perl: version: '5.038000' plugins: - class: Dist::Zilla::Plugin::Git::GatherDir config: Dist::Zilla::Plugin::GatherDir: exclude_filename: [] exclude_match: [] follow_symlinks: 0 include_dotfiles: 0 prefix: '' prune_directory: [] root: . Dist::Zilla::Plugin::Git::GatherDir: include_untracked: 0 name: '@RJBS/Git::GatherDir' version: '2.048' - class: Dist::Zilla::Plugin::CheckPrereqsIndexed name: '@RJBS/CheckPrereqsIndexed' version: '0.022' - class: Dist::Zilla::Plugin::CheckExtraTests name: '@RJBS/CheckExtraTests' version: '0.029' - class: Dist::Zilla::Plugin::PromptIfStale config: Dist::Zilla::Plugin::PromptIfStale: check_all_plugins: 0 check_all_prereqs: 0 modules: - Dist::Zilla::PluginBundle::RJBS phase: build run_under_travis: 0 skip: [] name: '@RJBS/RJBS-Outdated' version: '0.058' - class: Dist::Zilla::Plugin::PromptIfStale config: Dist::Zilla::Plugin::PromptIfStale: check_all_plugins: 1 check_all_prereqs: 0 modules: [] phase: release run_under_travis: 0 skip: - Dist::Zilla::Plugin::RJBSMisc name: '@RJBS/CPAN-Outdated' version: '0.058' - class: Dist::Zilla::Plugin::PruneCruft name: '@RJBS/@Filter/PruneCruft' version: '6.030' - class: Dist::Zilla::Plugin::ManifestSkip name: '@RJBS/@Filter/ManifestSkip' version: '6.030' - class: Dist::Zilla::Plugin::MetaYAML name: '@RJBS/@Filter/MetaYAML' version: '6.030' - class: Dist::Zilla::Plugin::License name: '@RJBS/@Filter/License' version: '6.030' - class: Dist::Zilla::Plugin::Readme name: '@RJBS/@Filter/Readme' version: '6.030' - class: Dist::Zilla::Plugin::ExecDir name: '@RJBS/@Filter/ExecDir' version: '6.030' - class: Dist::Zilla::Plugin::ShareDir name: '@RJBS/@Filter/ShareDir' version: '6.030' - class: Dist::Zilla::Plugin::Manifest name: '@RJBS/@Filter/Manifest' version: '6.030' - class: Dist::Zilla::Plugin::TestRelease name: '@RJBS/@Filter/TestRelease' version: '6.030' - class: Dist::Zilla::Plugin::ConfirmRelease name: '@RJBS/@Filter/ConfirmRelease' version: '6.030' - class: Dist::Zilla::Plugin::UploadToCPAN name: '@RJBS/@Filter/UploadToCPAN' version: '6.030' - class: Dist::Zilla::Plugin::MakeMaker config: Dist::Zilla::Role::TestRunner: default_jobs: 9 name: '@RJBS/MakeMaker' version: '6.030' - class: Dist::Zilla::Plugin::AutoPrereqs name: '@RJBS/AutoPrereqs' version: '6.030' - class: Dist::Zilla::Plugin::Git::NextVersion config: Dist::Zilla::Plugin::Git::NextVersion: first_version: '0.001' version_by_branch: 1 version_regexp: (?^:^([0-9]+\.[0-9]+)$) Dist::Zilla::Role::Git::Repo: git_version: 2.40.1 repo_root: . name: '@RJBS/Git::NextVersion' version: '2.048' - class: Dist::Zilla::Plugin::PkgVersion name: '@RJBS/PkgVersion' version: '6.030' - class: Dist::Zilla::Plugin::MetaConfig name: '@RJBS/MetaConfig' version: '6.030' - class: Dist::Zilla::Plugin::MetaJSON name: '@RJBS/MetaJSON' version: '6.030' - class: Dist::Zilla::Plugin::NextRelease name: '@RJBS/NextRelease' version: '6.030' - class: Dist::Zilla::Plugin::Test::ChangesHasContent name: '@RJBS/Test::ChangesHasContent' version: '0.011' - class: Dist::Zilla::Plugin::PodSyntaxTests name: '@RJBS/PodSyntaxTests' version: '6.030' - class: Dist::Zilla::Plugin::Test::ReportPrereqs name: '@RJBS/Test::ReportPrereqs' version: '0.029' - class: Dist::Zilla::Plugin::Git::Remote::Check name: '@RJBS/Git::Remote::Check' version: 0.1.2 - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: test type: requires name: '@RJBS/TestMoreWithSubtests' version: '6.030' - class: Dist::Zilla::Plugin::PodWeaver config: Dist::Zilla::Plugin::PodWeaver: config_plugins: - '@RJBS' finder: - ':InstallModules' - ':PerlExecFiles' plugins: - class: Pod::Weaver::Plugin::EnsurePod5 name: '@CorePrep/EnsurePod5' version: '4.019' - class: Pod::Weaver::Plugin::H1Nester name: '@CorePrep/H1Nester' version: '4.019' - class: Pod::Weaver::Plugin::SingleEncoding name: '@RJBS/SingleEncoding' version: '4.019' - class: Pod::Weaver::Section::Name name: '@RJBS/Name' version: '4.019' - class: Pod::Weaver::Section::Version name: '@RJBS/Version' version: '4.019' - class: Pod::Weaver::Section::Region name: '@RJBS/Prelude' version: '4.019' - class: Pod::Weaver::Section::Generic name: '@RJBS/Synopsis' version: '4.019' - class: Pod::Weaver::Section::Generic name: '@RJBS/Description' version: '4.019' - class: Pod::Weaver::Section::Generic name: '@RJBS/Overview' version: '4.019' - class: Pod::Weaver::Section::Generic name: '@RJBS/Stability' version: '4.019' - class: Pod::Weaver::Section::GenerateSection name: '@RJBS/PerlSupport' version: '4.019' - class: Pod::Weaver::Section::Collect name: Attributes version: '4.019' - class: Pod::Weaver::Section::Collect name: Methods version: '4.019' - class: Pod::Weaver::Section::Collect name: Functions version: '4.019' - class: Pod::Weaver::Section::Leftovers name: '@RJBS/Leftovers' version: '4.019' - class: Pod::Weaver::Section::Region name: '@RJBS/postlude' version: '4.019' - class: Pod::Weaver::Section::Authors name: '@RJBS/Authors' version: '4.019' - class: Pod::Weaver::Section::Contributors name: '@RJBS/Contributors' version: '0.009' - class: Pod::Weaver::Section::Legal name: '@RJBS/Legal' version: '4.019' - class: Pod::Weaver::Plugin::Transformer name: '@RJBS/List' version: '4.019' name: '@RJBS/PodWeaver' version: '4.010' - class: Dist::Zilla::Plugin::RJBSMisc name: '@RJBS/RJBSMisc' version: '5.024' - class: Dist::Zilla::Plugin::GithubMeta name: '@RJBS/GithubMeta' version: '0.58' - class: Dist::Zilla::Plugin::Git::Check config: Dist::Zilla::Plugin::Git::Check: untracked_files: die Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - Changes - dist.ini allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.40.1 repo_root: . name: '@RJBS/@Git/Check' version: '2.048' - class: Dist::Zilla::Plugin::Git::Commit config: Dist::Zilla::Plugin::Git::Commit: add_files_in: [] commit_msg: v%V%n%n%c signoff: 0 Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - Changes - dist.ini allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.40.1 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@RJBS/@Git/Commit' version: '2.048' - class: Dist::Zilla::Plugin::Git::Tag config: Dist::Zilla::Plugin::Git::Tag: branch: ~ changelog: Changes signed: 0 tag: '3.007' tag_format: '%v' tag_message: v%V Dist::Zilla::Role::Git::Repo: git_version: 2.40.1 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@RJBS/@Git/Tag' version: '2.048' - class: Dist::Zilla::Plugin::Git::Push config: Dist::Zilla::Plugin::Git::Push: push_to: - 'github :' remotes_must_exist: 0 Dist::Zilla::Role::Git::Repo: git_version: 2.40.1 repo_root: . name: '@RJBS/@Git/Push' version: '2.048' - class: Dist::Zilla::Plugin::Git::Contributors config: Dist::Zilla::Plugin::Git::Contributors: git_version: 2.40.1 include_authors: 0 include_releaser: 1 order_by: name paths: [] name: '@RJBS/Git::Contributors' version: '0.036' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: runtime type: requires name: Prereqs version: '6.030' - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' version: '6.030' - class: Dist::Zilla::Plugin::FinderCode name: ':IncModules' version: '6.030' - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: '6.030' - class: Dist::Zilla::Plugin::FinderCode name: ':ExtraTestFiles' version: '6.030' - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: '6.030' - class: Dist::Zilla::Plugin::FinderCode name: ':PerlExecFiles' version: '6.030' - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: '6.030' - class: Dist::Zilla::Plugin::FinderCode name: ':MainModule' version: '6.030' - class: Dist::Zilla::Plugin::FinderCode name: ':AllFiles' version: '6.030' - class: Dist::Zilla::Plugin::FinderCode name: ':NoFiles' version: '6.030' zilla: class: Dist::Zilla::Dist::Builder config: is_trial: 0 version: '6.030' x_contributors: - 'Charlie Garrison ' - 'Christopher J. Madsen ' - 'Dagfinn Ilmari Mannsåker ' - 'Dan Book ' - 'George Hartzell ' - 'Jon Stuart ' - 'Matt Phillips ' - 'Olivier Mengué ' - 'Randy Stauner ' - 'Ricardo Signes ' - 'Ricardo Signes ' - 'Sawyer X ' x_generated_by_perl: v5.38.0 x_rjbs_perl_window: long-term x_serialization_backend: 'YAML::Tiny version 1.74' x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later' Log-Dispatchouli-3.007/lib/000755 000765 000024 00000000000 14474750275 015562 5ustar00rjbsstaff000000 000000 Log-Dispatchouli-3.007/Makefile.PL000644 000765 000024 00000004552 14474750275 016774 0ustar00rjbsstaff000000 000000 # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.030. use strict; use warnings; use 5.020000; use ExtUtils::MakeMaker 6.78; my %WriteMakefileArgs = ( "ABSTRACT" => "a simple wrapper around Log::Dispatch", "AUTHOR" => "Ricardo SIGNES ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => "6.78" }, "DISTNAME" => "Log-Dispatchouli", "LICENSE" => "perl", "MIN_PERL_VERSION" => "5.020000", "NAME" => "Log::Dispatchouli", "PREREQ_PM" => { "Carp" => 0, "File::Spec" => 0, "Log::Dispatch" => 0, "Log::Dispatch::Array" => 0, "Log::Dispatch::File" => 0, "Log::Dispatch::Screen" => 0, "Log::Dispatch::Syslog" => 0, "Params::Util" => 0, "Scalar::Util" => 0, "String::Flogger" => 0, "Sub::Exporter" => 0, "Sub::Exporter::GlobExporter" => "0.002", "Sys::Syslog" => "0.16", "Try::Tiny" => "0.04", "experimental" => 0, "overload" => 0, "strict" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "File::Spec::Functions" => 0, "File::Temp" => 0, "JSON::MaybeXS" => 0, "Test::Deep" => 0, "Test::Fatal" => 0, "Test::More" => "0.96", "base" => 0, "lib" => 0, "utf8" => 0 }, "VERSION" => "3.007", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Carp" => 0, "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "File::Spec::Functions" => 0, "File::Temp" => 0, "JSON::MaybeXS" => 0, "Log::Dispatch" => 0, "Log::Dispatch::Array" => 0, "Log::Dispatch::File" => 0, "Log::Dispatch::Screen" => 0, "Log::Dispatch::Syslog" => 0, "Params::Util" => 0, "Scalar::Util" => 0, "String::Flogger" => 0, "Sub::Exporter" => 0, "Sub::Exporter::GlobExporter" => "0.002", "Sys::Syslog" => "0.16", "Test::Deep" => 0, "Test::Fatal" => 0, "Test::More" => "0.96", "Try::Tiny" => "0.04", "base" => 0, "experimental" => 0, "lib" => 0, "overload" => 0, "strict" => 0, "utf8" => 0, "warnings" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); Log-Dispatchouli-3.007/META.json000644 000765 000024 00000047476 14474750275 016457 0ustar00rjbsstaff000000 000000 { "abstract" : "a simple wrapper around Log::Dispatch", "author" : [ "Ricardo SIGNES " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.030, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Log-Dispatchouli", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.78" } }, "develop" : { "requires" : { "Encode" : "0", "Test::More" : "0", "Test::Pod" : "1.41" } }, "runtime" : { "requires" : { "Carp" : "0", "File::Spec" : "0", "Log::Dispatch" : "0", "Log::Dispatch::Array" : "0", "Log::Dispatch::File" : "0", "Log::Dispatch::Screen" : "0", "Log::Dispatch::Syslog" : "0", "Params::Util" : "0", "Scalar::Util" : "0", "String::Flogger" : "0", "Sub::Exporter" : "0", "Sub::Exporter::GlobExporter" : "0.002", "Sys::Syslog" : "0.16", "Try::Tiny" : "0.04", "experimental" : "0", "overload" : "0", "perl" : "v5.20.0", "strict" : "0", "warnings" : "0" } }, "test" : { "recommends" : { "CPAN::Meta" : "2.120900" }, "requires" : { "ExtUtils::MakeMaker" : "0", "File::Spec" : "0", "File::Spec::Functions" : "0", "File::Temp" : "0", "JSON::MaybeXS" : "0", "Test::Deep" : "0", "Test::Fatal" : "0", "Test::More" : "0.96", "base" : "0", "lib" : "0", "utf8" : "0" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/rjbs/Log-Dispatchouli/issues" }, "homepage" : "https://github.com/rjbs/Log-Dispatchouli", "repository" : { "type" : "git", "url" : "https://github.com/rjbs/Log-Dispatchouli.git", "web" : "https://github.com/rjbs/Log-Dispatchouli" } }, "version" : "3.007", "x_Dist_Zilla" : { "perl" : { "version" : "5.038000" }, "plugins" : [ { "class" : "Dist::Zilla::Plugin::Git::GatherDir", "config" : { "Dist::Zilla::Plugin::GatherDir" : { "exclude_filename" : [], "exclude_match" : [], "follow_symlinks" : 0, "include_dotfiles" : 0, "prefix" : "", "prune_directory" : [], "root" : "." }, "Dist::Zilla::Plugin::Git::GatherDir" : { "include_untracked" : 0 } }, "name" : "@RJBS/Git::GatherDir", "version" : "2.048" }, { "class" : "Dist::Zilla::Plugin::CheckPrereqsIndexed", "name" : "@RJBS/CheckPrereqsIndexed", "version" : "0.022" }, { "class" : "Dist::Zilla::Plugin::CheckExtraTests", "name" : "@RJBS/CheckExtraTests", "version" : "0.029" }, { "class" : "Dist::Zilla::Plugin::PromptIfStale", "config" : { "Dist::Zilla::Plugin::PromptIfStale" : { "check_all_plugins" : 0, "check_all_prereqs" : 0, "modules" : [ "Dist::Zilla::PluginBundle::RJBS" ], "phase" : "build", "run_under_travis" : 0, "skip" : [] } }, "name" : "@RJBS/RJBS-Outdated", "version" : "0.058" }, { "class" : "Dist::Zilla::Plugin::PromptIfStale", "config" : { "Dist::Zilla::Plugin::PromptIfStale" : { "check_all_plugins" : 1, "check_all_prereqs" : 0, "modules" : [], "phase" : "release", "run_under_travis" : 0, "skip" : [ "Dist::Zilla::Plugin::RJBSMisc" ] } }, "name" : "@RJBS/CPAN-Outdated", "version" : "0.058" }, { "class" : "Dist::Zilla::Plugin::PruneCruft", "name" : "@RJBS/@Filter/PruneCruft", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::ManifestSkip", "name" : "@RJBS/@Filter/ManifestSkip", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::MetaYAML", "name" : "@RJBS/@Filter/MetaYAML", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::License", "name" : "@RJBS/@Filter/License", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::Readme", "name" : "@RJBS/@Filter/Readme", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::ExecDir", "name" : "@RJBS/@Filter/ExecDir", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::ShareDir", "name" : "@RJBS/@Filter/ShareDir", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::Manifest", "name" : "@RJBS/@Filter/Manifest", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::TestRelease", "name" : "@RJBS/@Filter/TestRelease", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::ConfirmRelease", "name" : "@RJBS/@Filter/ConfirmRelease", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::UploadToCPAN", "name" : "@RJBS/@Filter/UploadToCPAN", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::MakeMaker", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 9 } }, "name" : "@RJBS/MakeMaker", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::AutoPrereqs", "name" : "@RJBS/AutoPrereqs", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::Git::NextVersion", "config" : { "Dist::Zilla::Plugin::Git::NextVersion" : { "first_version" : "0.001", "version_by_branch" : 1, "version_regexp" : "(?^:^([0-9]+\\.[0-9]+)$)" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.40.1", "repo_root" : "." } }, "name" : "@RJBS/Git::NextVersion", "version" : "2.048" }, { "class" : "Dist::Zilla::Plugin::PkgVersion", "name" : "@RJBS/PkgVersion", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::MetaConfig", "name" : "@RJBS/MetaConfig", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::MetaJSON", "name" : "@RJBS/MetaJSON", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::NextRelease", "name" : "@RJBS/NextRelease", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::Test::ChangesHasContent", "name" : "@RJBS/Test::ChangesHasContent", "version" : "0.011" }, { "class" : "Dist::Zilla::Plugin::PodSyntaxTests", "name" : "@RJBS/PodSyntaxTests", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::Test::ReportPrereqs", "name" : "@RJBS/Test::ReportPrereqs", "version" : "0.029" }, { "class" : "Dist::Zilla::Plugin::Git::Remote::Check", "name" : "@RJBS/Git::Remote::Check", "version" : "0.1.2" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "test", "type" : "requires" } }, "name" : "@RJBS/TestMoreWithSubtests", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::PodWeaver", "config" : { "Dist::Zilla::Plugin::PodWeaver" : { "config_plugins" : [ "@RJBS" ], "finder" : [ ":InstallModules", ":PerlExecFiles" ], "plugins" : [ { "class" : "Pod::Weaver::Plugin::EnsurePod5", "name" : "@CorePrep/EnsurePod5", "version" : "4.019" }, { "class" : "Pod::Weaver::Plugin::H1Nester", "name" : "@CorePrep/H1Nester", "version" : "4.019" }, { "class" : "Pod::Weaver::Plugin::SingleEncoding", "name" : "@RJBS/SingleEncoding", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Name", "name" : "@RJBS/Name", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Version", "name" : "@RJBS/Version", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@RJBS/Prelude", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "@RJBS/Synopsis", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "@RJBS/Description", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "@RJBS/Overview", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "@RJBS/Stability", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::GenerateSection", "name" : "@RJBS/PerlSupport", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "Attributes", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "Methods", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "Functions", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Leftovers", "name" : "@RJBS/Leftovers", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@RJBS/postlude", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Authors", "name" : "@RJBS/Authors", "version" : "4.019" }, { "class" : "Pod::Weaver::Section::Contributors", "name" : "@RJBS/Contributors", "version" : "0.009" }, { "class" : "Pod::Weaver::Section::Legal", "name" : "@RJBS/Legal", "version" : "4.019" }, { "class" : "Pod::Weaver::Plugin::Transformer", "name" : "@RJBS/List", "version" : "4.019" } ] } }, "name" : "@RJBS/PodWeaver", "version" : "4.010" }, { "class" : "Dist::Zilla::Plugin::RJBSMisc", "name" : "@RJBS/RJBSMisc", "version" : "5.024" }, { "class" : "Dist::Zilla::Plugin::GithubMeta", "name" : "@RJBS/GithubMeta", "version" : "0.58" }, { "class" : "Dist::Zilla::Plugin::Git::Check", "config" : { "Dist::Zilla::Plugin::Git::Check" : { "untracked_files" : "die" }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "Changes", "dist.ini" ], "allow_dirty_match" : [], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.40.1", "repo_root" : "." } }, "name" : "@RJBS/@Git/Check", "version" : "2.048" }, { "class" : "Dist::Zilla::Plugin::Git::Commit", "config" : { "Dist::Zilla::Plugin::Git::Commit" : { "add_files_in" : [], "commit_msg" : "v%V%n%n%c", "signoff" : 0 }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "Changes", "dist.ini" ], "allow_dirty_match" : [], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.40.1", "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@RJBS/@Git/Commit", "version" : "2.048" }, { "class" : "Dist::Zilla::Plugin::Git::Tag", "config" : { "Dist::Zilla::Plugin::Git::Tag" : { "branch" : null, "changelog" : "Changes", "signed" : 0, "tag" : "3.007", "tag_format" : "%v", "tag_message" : "v%V" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.40.1", "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@RJBS/@Git/Tag", "version" : "2.048" }, { "class" : "Dist::Zilla::Plugin::Git::Push", "config" : { "Dist::Zilla::Plugin::Git::Push" : { "push_to" : [ "github :" ], "remotes_must_exist" : 0 }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.40.1", "repo_root" : "." } }, "name" : "@RJBS/@Git/Push", "version" : "2.048" }, { "class" : "Dist::Zilla::Plugin::Git::Contributors", "config" : { "Dist::Zilla::Plugin::Git::Contributors" : { "git_version" : "2.40.1", "include_authors" : 0, "include_releaser" : 1, "order_by" : "name", "paths" : [] } }, "name" : "@RJBS/Git::Contributors", "version" : "0.036" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "runtime", "type" : "requires" } }, "name" : "Prereqs", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":InstallModules", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":IncModules", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":TestFiles", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExtraTestFiles", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExecFiles", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":PerlExecFiles", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ShareFiles", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":MainModule", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":AllFiles", "version" : "6.030" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":NoFiles", "version" : "6.030" } ], "zilla" : { "class" : "Dist::Zilla::Dist::Builder", "config" : { "is_trial" : 0 }, "version" : "6.030" } }, "x_contributors" : [ "Charlie Garrison ", "Christopher J. Madsen ", "Dagfinn Ilmari Manns\u00e5ker ", "Dan Book ", "George Hartzell ", "Jon Stuart ", "Matt Phillips ", "Olivier Mengu\u00e9 ", "Randy Stauner ", "Ricardo Signes ", "Ricardo Signes ", "Sawyer X " ], "x_generated_by_perl" : "v5.38.0", "x_rjbs_perl_window" : "long-term", "x_serialization_backend" : "Cpanel::JSON::XS version 4.36", "x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later" } Log-Dispatchouli-3.007/dist.ini000644 000765 000024 00000000320 14474750275 016453 0ustar00rjbsstaff000000 000000 name = Log-Dispatchouli author = Ricardo SIGNES license = Perl_5 copyright_holder = Ricardo SIGNES [@RJBS] perl-window = long-term [Prereqs] Sys::Syslog = 0.16 ; native socket type Log-Dispatchouli-3.007/lib/Log/000755 000765 000024 00000000000 14474750275 016303 5ustar00rjbsstaff000000 000000 Log-Dispatchouli-3.007/lib/Log/Fmt.pm000644 000765 000024 00000020603 14474750275 017370 0ustar00rjbsstaff000000 000000 use v5.20; use warnings; package Log::Fmt 3.007; # ABSTRACT: a little parser and emitter of structured log lines use experimental 'postderef'; # Not dangerous. Is accepted without changed. use Params::Util qw(_ARRAY0 _HASH0 _CODELIKE); use Scalar::Util qw(refaddr); use String::Flogger (); #pod =head1 OVERVIEW #pod #pod This library primarily exists to service L's C #pod methods. It converts an arrayref of key/value pairs to a string that a human #pod can scan tolerably well, and which a machine can parse about as well. It can #pod also do that tolerably-okay parsing for you. #pod #pod =cut #pod =method format_event_string #pod #pod my $string = Log::Fmt->format_event_string([ #pod key1 => $value1, #pod key2 => $value2, #pod ]); #pod #pod Note especially that if any value to encode is a reference I, #pod then String::Flogger is used to encode the referenced value. This means you #pod can embed, in your logfmt, a JSON dump of a structure by passing a reference to #pod the structure, instead of passing the structure itself. #pod #pod =cut # ASCII after SPACE but excluding = and " my $IDENT_RE = qr{[\x21\x23-\x3C\x3E-\x7E]+}; sub _quote_string { my ($string) = @_; $string =~ s{\\}{\\\\}g; $string =~ s{"}{\\"}g; $string =~ s{\x0A}{\\n}g; $string =~ s{\x0D}{\\r}g; $string =~ s{([\pC\v])}{sprintf '\\x{%x}', ord $1}ge; return qq{"$string"}; } sub string_flogger { 'String::Flogger' } sub _pairs_to_kvstr_aref { my ($self, $aref, $seen, $prefix) = @_; $seen //= {}; my @kvstrs; KEY: for (my $i = 0; $i < @$aref; $i += 2) { # replace non-ident-safe chars with ? my $key = length $aref->[$i] ? "$aref->[$i]" : '~'; $key =~ tr/\x21\x23-\x3C\x3E-\x7E/?/c; # If the prefix is "" you can end up with a pair like ".foo=1" which is # weird but probably best. And that means you could end up with # "foo..bar=1" which is also weird, but still probably for the best. $key = "$prefix.$key" if defined $prefix; my $value = $aref->[$i+1]; if (_CODELIKE $value) { $value = $value->(); } if (ref $value && ref $value eq 'REF') { $value = $self->string_flogger->flog([ '%s', $$value ]); } if (! defined $value) { $value = '~missing~'; } elsif (ref $value) { my $refaddr = refaddr $value; if ($seen->{ $refaddr }) { $value = $seen->{ $refaddr }; } elsif (_ARRAY0($value)) { $seen->{ $refaddr } = "&$key"; push @kvstrs, $self->_pairs_to_kvstr_aref( [ map {; $_ => $value->[$_] } (0 .. $#$value) ], $seen, $key, )->@*; next KEY; } elsif (_HASH0($value)) { $seen->{ $refaddr } = "&$key"; push @kvstrs, $self->_pairs_to_kvstr_aref( [ $value->%{ sort keys %$value } ], $seen, $key, )->@*; next KEY; } else { $value = "$value"; # Meh. } } my $str = "$key=" . ($value =~ /\A$IDENT_RE\z/ ? "$value" : _quote_string($value)); push @kvstrs, $str; } return \@kvstrs; } sub format_event_string { my ($self, $aref) = @_; return join q{ }, $self->_pairs_to_kvstr_aref($aref)->@*; } #pod =method parse_event_string #pod #pod my $kv_pairs = Log::Fmt->parse_event_string($string); #pod #pod Given the kind of string emitted by C, this method returns #pod a reference to an array of key/value pairs. #pod #pod This isn't exactly a round trip. First off, the formatting can change illegal #pod keys by replacing characters with question marks, or replacing empty strings #pod with tildes. Secondly, the formatter will expand some values like arrayrefs #pod and hashrefs into multiple keys, but the parser will not recombined those keys #pod into structures. Also, there might be other asymmetric conversions. That #pod said, the string escaping done by the formatter should correctly reverse. #pod #pod If the input string is badly formed, hunks that don't appear to be value #pod key/value pairs will be presented as values for the key C. #pod #pod =cut sub parse_event_string { my ($self, $string) = @_; my @result; HUNK: while (length $string) { if ($string =~ s/\A($IDENT_RE)=($IDENT_RE)(?:\s+|\z)//) { push @result, $1, $2; next HUNK; } if ($string =~ s/\A($IDENT_RE)="((\\\\|\\"|[^"])*?)"(?:\s+|\z)//) { my $key = $1; my $qstring = $2; $qstring =~ s{ ( \\\\ | \\["nr] | (\\x)\{([[:xdigit:]]{1,5})\} ) } { $1 eq "\\\\" ? "\\" : $1 eq "\\\"" ? q{"} : $1 eq "\\n" ? qq{\n} : $1 eq "\\r" ? qq{\r} : ($2//'') eq "\\x" ? chr(hex("0x$3")) : $1 }gex; push @result, $key, $qstring; # TODO: do unescaping here next HUNK; } if ($string =~ s/\A(\S+)(?:\s+|\z)//) { push @result, 'junk', $1; next HUNK; } # I hope this is unreachable. -- rjbs, 2022-11-03 push (@result, 'junk', $string, aborted => 1); last HUNK; } return \@result; } #pod =method parse_event_string_as_hash #pod #pod my $hashref = Log::Fmt->parse_event_string_as_hash($line); #pod #pod This parses the given line as logfmt, then puts the key/value pairs into a hash #pod and returns a reference to it. #pod #pod Because nothing prevents a single key from appearing more than once, you should #pod use this with the understanding that data could be lost. No guarantee is made #pod of which value will be preserved. #pod #pod =cut sub parse_event_string_as_hash { my ($self, $string) = @_; return { $self->parse_event_string($string)->@* }; } 1; __END__ =pod =encoding UTF-8 =head1 NAME Log::Fmt - a little parser and emitter of structured log lines =head1 VERSION version 3.007 =head1 OVERVIEW This library primarily exists to service L's C methods. It converts an arrayref of key/value pairs to a string that a human can scan tolerably well, and which a machine can parse about as well. It can also do that tolerably-okay parsing for you. =head1 PERL VERSION This library should run on perls released even a long time ago. It should work on any version of perl released in the last five years. Although it may work on older versions of perl, no guarantee is made that the minimum required version will not be increased. The version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl. =head1 METHODS =head2 format_event_string my $string = Log::Fmt->format_event_string([ key1 => $value1, key2 => $value2, ]); Note especially that if any value to encode is a reference I, then String::Flogger is used to encode the referenced value. This means you can embed, in your logfmt, a JSON dump of a structure by passing a reference to the structure, instead of passing the structure itself. =head2 parse_event_string my $kv_pairs = Log::Fmt->parse_event_string($string); Given the kind of string emitted by C, this method returns a reference to an array of key/value pairs. This isn't exactly a round trip. First off, the formatting can change illegal keys by replacing characters with question marks, or replacing empty strings with tildes. Secondly, the formatter will expand some values like arrayrefs and hashrefs into multiple keys, but the parser will not recombined those keys into structures. Also, there might be other asymmetric conversions. That said, the string escaping done by the formatter should correctly reverse. If the input string is badly formed, hunks that don't appear to be value key/value pairs will be presented as values for the key C. =head2 parse_event_string_as_hash my $hashref = Log::Fmt->parse_event_string_as_hash($line); This parses the given line as logfmt, then puts the key/value pairs into a hash and returns a reference to it. Because nothing prevents a single key from appearing more than once, you should use this with the understanding that data could be lost. No guarantee is made of which value will be preserved. =head1 AUTHOR Ricardo SIGNES =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2023 by Ricardo SIGNES. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Log-Dispatchouli-3.007/lib/Log/Dispatchouli/000755 000765 000024 00000000000 14474750275 020733 5ustar00rjbsstaff000000 000000 Log-Dispatchouli-3.007/lib/Log/Dispatchouli.pm000644 000765 000024 00000114010 14474750275 021266 0ustar00rjbsstaff000000 000000 use v5.20; use warnings; package Log::Dispatchouli 3.007; # ABSTRACT: a simple wrapper around Log::Dispatch use experimental 'postderef'; # Not dangerous. Is accepted without changed. use Carp (); use File::Spec (); use Log::Dispatch; use Log::Fmt (); use Params::Util qw(_ARRAY0 _HASH0 _CODELIKE); use Scalar::Util qw(blessed weaken); use String::Flogger; use Try::Tiny 0.04; require Log::Dispatchouli::Proxy; our @CARP_NOT = qw(Log::Dispatchouli::Proxy); #pod =head1 SYNOPSIS #pod #pod my $logger = Log::Dispatchouli->new({ #pod ident => 'stuff-purger', #pod facility => 'daemon', #pod to_stdout => $opt->{print}, #pod debug => $opt->{verbose} #pod }); #pod #pod $logger->log([ "There are %s items left to purge...", $stuff_left ]); #pod #pod $logger->log_debug("this is extra often-ignored debugging log"); #pod #pod $logger->log_fatal("Now we will die!!"); #pod #pod =head1 DESCRIPTION #pod #pod Log::Dispatchouli is a thin layer above L and meant to make it #pod dead simple to add logging to a program without having to think much about #pod categories, facilities, levels, or things like that. It is meant to make #pod logging just configurable enough that you can find the logs you want and just #pod easy enough that you will actually log things. #pod #pod Log::Dispatchouli can log to syslog (if you specify a facility), standard error #pod or standard output, to a file, or to an array in memory. That last one is #pod mostly useful for testing. #pod #pod In addition to providing as simple a way to get a handle for logging #pod operations, Log::Dispatchouli uses L to process the things to #pod be logged, meaning you can easily log data structures. Basically: strings are #pod logged as is, arrayrefs are taken as (sprintf format, args), and subroutines #pod are called only if needed. For more information read the L #pod docs. #pod #pod =head1 LOGGER PREFIX #pod #pod Log messages may be prepended with information to set context. This can be set #pod at a logger level or per log item. The simplest example is: #pod #pod my $logger = Log::Dispatchouli->new( ... ); #pod #pod $logger->set_prefix("Batch 123: "); #pod #pod $logger->log("begun processing"); #pod #pod # ... #pod #pod $logger->log("finished processing"); #pod #pod The above will log something like: #pod #pod Batch 123: begun processing #pod Batch 123: finished processing #pod #pod To pass a prefix per-message: #pod #pod $logger->log({ prefix => 'Sub-Item 234: ' }, 'error!') #pod #pod # Logs: Batch 123: Sub-Item 234: error! #pod #pod If the prefix is a string, it is prepended to each line of the message. If it #pod is a coderef, it is called and passed the message to be logged. The return #pod value is logged instead. #pod #pod L also have their own prefix #pod settings, which accumulate. So: #pod #pod my $proxy = $logger->proxy({ proxy_prefix => 'Subsystem 12: ' }); #pod #pod $proxy->set_prefix('Page 9: '); #pod #pod $proxy->log({ prefix => 'Paragraph 6: ' }, 'Done.'); #pod #pod ...will log... #pod #pod Batch 123: Subsystem 12: Page 9: Paragraph 6: Done. #pod #pod =method new #pod #pod my $logger = Log::Dispatchouli->new(\%arg); #pod #pod This returns a new logger, a Log::Dispatchouli object. #pod #pod Valid arguments are: #pod #pod ident - the name of the thing logging (mandatory) #pod to_self - log to the logger object for testing; default: false #pod to_stdout - log to STDOUT; default: false #pod to_stderr - log to STDERR; default: false #pod facility - to which syslog facility to send logs; default: none #pod #pod to_file - log to PROGRAM_NAME.YYYYMMDD in the log path; default: false #pod log_file - a leaf name for the file to log to with to_file #pod log_path - path in which to log to file; defaults to DISPATCHOULI_PATH #pod environment variable or, failing that, to your system's tmpdir #pod #pod file_format - this optional coderef is passed the message to be logged #pod and returns the text to write out #pod #pod log_pid - if true, prefix all log entries with the pid; default: true #pod fail_fatal - a boolean; if true, failure to log is fatal; default: true #pod muted - a boolean; if true, only fatals are logged; default: false #pod debug - a boolean; if true, log_debug method is not a no-op #pod defaults to the truth of the DISPATCHOULI_DEBUG env var #pod quiet_fatal - 'stderr' or 'stdout' or an arrayref of zero, one, or both #pod fatal log messages will not be logged to these #pod (default: stderr) #pod config_id - a name for this logger's config; rarely needed! #pod syslog_socket - a value for Sys::Syslog's "socket" arg; default: "native" #pod #pod The log path is either F or the value of the F env var. #pod #pod If the F env var is true, we don't log to syslog. #pod #pod =cut sub new { my ($class, $arg) = @_; my $ident = $arg->{ident} or Carp::croak "no ident specified when using $class"; my $config_id = defined $arg->{config_id} ? $arg->{config_id} : $ident; my %quiet_fatal; for ('quiet_fatal') { %quiet_fatal = map {; $_ => 1 } grep { defined } exists $arg->{$_} ? _ARRAY0($arg->{$_}) ? @{ $arg->{$_} } : $arg->{$_} : ('stderr'); }; my $log = Log::Dispatch->new; my $self = bless { dispatcher => $log, log_pid => (exists $arg->{log_pid} ? $arg->{log_pid} : 1), } => $class; if ($arg->{to_file}) { require Log::Dispatch::File; my $log_file = File::Spec->catfile( ($arg->{log_path} || $self->env_value('PATH') || File::Spec->tmpdir), $arg->{log_file} || do { my @time = localtime; sprintf('%s.%04u%02u%02u', $ident, $time[5] + 1900, $time[4] + 1, $time[3]) } ); $log->add( Log::Dispatch::File->new( name => 'logfile', min_level => 'debug', filename => $log_file, mode => 'append', callbacks => do { if (my $format = $arg->{file_format}) { sub { my $message = {@_}->{message}; $message = "[$$] $message" if $self->{log_pid}; $format->($message) }; } else { # The time format returned here is subject to change. -- rjbs, # 2008-11-21 sub { my $message = {@_}->{message}; $message = "[$$] $message" if $self->{log_pid}; (localtime) . " $message\n"; }; } }, ) ); } if ($arg->{facility} and not $self->env_value('NOSYSLOG')) { $self->setup_syslog_output( facility => $arg->{facility}, socket => $arg->{syslog_socket}, ident => $ident, ); } if ($arg->{to_self}) { $self->{events} = []; require Log::Dispatch::Array; $log->add( Log::Dispatch::Array->new( name => 'self', min_level => 'debug', array => $self->{events}, ($self->{log_pid} ? (callbacks => sub { "[$$] ". {@_}->{message} }) : ()) ), ); } $self->{prefix} = $arg->{prefix}; $self->{ident} = $ident; $self->{config_id} = $config_id; DEST: for my $dest (qw(err out)) { next DEST unless $arg->{"to_std$dest"}; my $method = "enable_std$dest"; $self->$method; } $self->{debug} = exists $arg->{debug} ? ($arg->{debug} ? 1 : 0) : ($self->env_value('DEBUG') ? 1 : 0); $self->{muted} = $arg->{muted}; $self->{quiet_fatal} = \%quiet_fatal; $self->{fail_fatal} = exists $arg->{fail_fatal} ? $arg->{fail_fatal} : 1; return $self; } for my $dest (qw(out err)) { my $name = "std$dest"; my $code = sub { return if $_[0]->dispatcher->output($name); my $callback = $_[0]->{log_pid} ? sub { "[$$] " . ({@_}->{message}) . "\n" } : sub { ({@_}->{message}) . "\n" }; $_[0]->dispatcher->add( $_[0]->stdio_dispatcher_class->new( name => "std$dest", min_level => 'debug', stderr => ($dest eq 'err' ? 1 : 0), callbacks => $callback, ($_[0]{quiet_fatal}{"std$dest"} ? (max_level => 'info') : ()), ), ); }; no strict 'refs'; *{"enable_std$dest"} = $code; } sub setup_syslog_output { my ($self, %arg) = @_; require Log::Dispatch::Syslog; $self->{dispatcher}->add( Log::Dispatch::Syslog->new( name => 'syslog', min_level => 'debug', facility => $arg{facility}, ident => $arg{ident}, logopt => ($self->{log_pid} ? 'pid' : ''), socket => $arg{socket} || 'native', callbacks => sub { ( my $m = {@_}->{message} ) =~ s/\n//g; $m }, ), ); } #pod =method log #pod #pod $logger->log(@messages); #pod #pod $logger->log(\%arg, @messages); #pod #pod This method uses L on the input, then I logs #pod the result. Each message is flogged individually, then joined with spaces. #pod #pod If the first argument is a hashref, it will be used as extra arguments to #pod logging. It may include a C entry to preprocess the message by #pod prepending a string (if the prefix is a string) or calling a subroutine to #pod generate a new message (if the prefix is a coderef). #pod #pod =cut sub _join { shift; join q{ }, @{ $_[0] } } sub log { my ($self, @rest) = @_; my $arg = _HASH0($rest[0]) ? shift(@rest) : {}; my $message; if ($arg->{fatal} or ! $self->get_muted) { try { my $flogger = $self->string_flogger; my @flogged = map {; $flogger->flog($_) } @rest; $message = @flogged > 1 ? $self->_join(\@flogged) : $flogged[0]; my @prefix = _ARRAY0($arg->{prefix}) ? @{ $arg->{prefix} } : $arg->{prefix}; for (reverse grep { defined } $self->get_prefix, @prefix) { if (_CODELIKE( $_ )) { $message = $_->($message); } else { $message =~ s/^/$_/gm; } } $self->dispatcher->log( level => $arg->{level} || 'info', message => $message, ); } catch { $message = '(no message could be logged)' unless defined $message; die $_ if $self->{fail_fatal}; }; } Carp::croak $message if $arg->{fatal}; return; } #pod =method log_fatal #pod #pod This behaves like the C method, but will throw the logged string as an #pod exception after logging. #pod #pod This method can also be called as C, to match other popular logging #pod interfaces. B and not C>. #pod #pod =cut sub log_fatal { my ($self, @rest) = @_; my $arg = _HASH0($rest[0]) ? shift(@rest) : {}; # for future expansion local $arg->{level} = defined $arg->{level} ? $arg->{level} : 'error'; local $arg->{fatal} = defined $arg->{fatal} ? $arg->{fatal} : 1; $self->log($arg, @rest); } #pod =method log_debug #pod #pod This behaves like the C method, but will only log (at the debug level) if #pod the logger object has its debug property set to true. #pod #pod This method can also be called as C, to match other popular logging #pod interfaces. B and not C>. #pod #pod =cut sub log_debug { my ($self, @rest) = @_; return unless $self->is_debug; my $arg = _HASH0($rest[0]) ? shift(@rest) : {}; # for future expansion local $arg->{level} = defined $arg->{level} ? $arg->{level} : 'debug'; $self->log($arg, @rest); } #pod =method log_event #pod #pod This method is like C, but is used for structured logging instead of free #pod form text. It's invoked like this: #pod #pod $logger->log($event_type => $data_ref); #pod #pod C<$event_type> should be a simple string, probably a valid identifier, that #pod identifies the kind of event being logged. It is suggested, but not required, #pod that all events of the same type have the same kind of structured data in them. #pod #pod C<$data_ref> is a set of key/value pairs of data to log in this event. It can #pod be an arrayref (in which case the ordering of pairs is preserved) or a hashref #pod (in which case they are sorted by key). #pod #pod The logged string will be in logfmt format, meaning a series of key=value #pod pairs separated by spaces and following these rules: #pod #pod =for :list #pod * an "identifier" is a string of printable ASCII characters between C and #pod C<~>, excluding C<\> and C<=> #pod * keys must be valid identifiers #pod * if a key is empty, C<~> is used instead #pod * if a key contains characters not permitted in an identifier, they are #pod replaced by C #pod * values must I be valid identifiers, or be quoted #pod * quoted value start and end with C<"> #pod * in a quoted value, C<"> becomes C<\">, C<\> becomes C<\\>, newline and #pod carriage return become C<\n> and C<\r> respectively, and other control #pod characters are replaced with C<\u{....}> where the contents of the braces are #pod the hex value of the control character #pod #pod When values are undef, they are represented as C<~>. #pod #pod When values are array references, the index/values are mapped over, so that: #pod #pod key => [ 'a', 'b' ] #pod #pod becomes #pod #pod key.0=a key.1=b #pod #pod When values are hash references, the key/values are mapped, with keys sorted, #pod so that: #pod #pod key => { b => 2, a => 1 } #pod #pod becomes #pod #pod key.a=1 key.b=2 #pod #pod This expansion is performed recursively. If a value itself recurses, #pod appearances of a reference after the first time will be replaced with a string #pod like C<&foo.bar>, pointing to the first occurrence. I It's just here to help you be a little #pod lazy. Don't push the limits. #pod #pod If the value in C<$data_ref> is a code reference, it will be called and its #pod result logged. If its result is also a code reference, you get whatever #pod garbage that code reference stringifies to. #pod #pod If the value in C<$data_ref> is a reference reference, then the referenced #pod scalar will be passed to String::Flogger, and the resulting string will be used #pod as the value to log. That string will be quoted as described above, if needed. #pod #pod =cut sub log_event { my ($self, $type, $data) = @_; return $self->_log_event($type, undef, $data); } sub _compute_proxy_ctx_kvstr_aref { return []; } sub _log_event { my ($self, $type, $ctx, $data) = @_; return if $self->get_muted; my $kv_aref = Log::Fmt->_pairs_to_kvstr_aref([ event => $type, (_ARRAY0($data) ? @$data : $data->%{ sort keys %$data }) ]); splice @$kv_aref, 1, 0, @$ctx if $ctx; $self->dispatcher->log( level => 'info', message => join q{ }, @$kv_aref, ); return; } #pod =method log_debug_event #pod #pod This method is just like C, but will log nothing unless the logger #pod has its C property set to true. #pod #pod =cut sub log_debug_event { my ($self, $type, $data) = @_; return unless $self->get_debug; $self->log_event($type, $data); } #pod =method set_debug #pod #pod $logger->set_debug($bool); #pod #pod This sets the logger's debug property, which affects the behavior of #pod C. #pod #pod =cut sub set_debug { return($_[0]->{debug} = $_[1] ? 1 : 0); } #pod =method get_debug #pod #pod This gets the logger's debug property, which affects the behavior of #pod C. #pod #pod =cut sub get_debug { return $_[0]->{debug} } #pod =method clear_debug #pod #pod This method does nothing, and is only useful for L #pod objects. See L, below. #pod #pod =cut sub clear_debug { } sub mute { $_[0]{muted} = 1 } sub unmute { $_[0]{muted} = 0 } #pod =method set_muted #pod #pod $logger->set_muted($bool); #pod #pod This sets the logger's muted property, which affects the behavior of #pod C. #pod #pod =cut sub set_muted { return($_[0]->{muted} = $_[1] ? 1 : 0); } #pod =method get_muted #pod #pod This gets the logger's muted property, which affects the behavior of #pod C. #pod #pod =cut sub get_muted { return $_[0]->{muted} } #pod =method clear_muted #pod #pod This method does nothing, and is only useful for L #pod objects. See L, below. #pod #pod =cut sub clear_muted { } #pod =method get_prefix #pod #pod my $prefix = $logger->get_prefix; #pod #pod This method returns the currently-set prefix for the logger, which may be a #pod string or code reference or undef. See L. #pod #pod =method set_prefix #pod #pod $logger->set_prefix( $new_prefix ); #pod #pod This method changes the prefix. See L. #pod #pod =method clear_prefix #pod #pod This method clears any set logger prefix. (It can also be called as #pod C, but this is deprecated. See L. #pod #pod =cut sub get_prefix { return $_[0]->{prefix} } sub set_prefix { $_[0]->{prefix} = $_[1] } sub clear_prefix { $_[0]->unset_prefix } sub unset_prefix { undef $_[0]->{prefix} } #pod =method ident #pod #pod This method returns the logger's ident. #pod #pod =cut sub ident { $_[0]{ident} } #pod =method config_id #pod #pod This method returns the logger's configuration id, which defaults to its ident. #pod This can be used to make two loggers equivalent in Log::Dispatchouli::Global so #pod that trying to reinitialize with a new logger with the same C as the #pod current logger will not throw an exception, and will simply do no thing. #pod #pod =cut sub config_id { $_[0]{config_id} } #pod =head1 METHODS FOR SUBCLASSING #pod #pod =head2 string_flogger #pod #pod This method returns the thing on which F will be called to format log #pod messages. By default, it just returns C #pod #pod =cut sub string_flogger { 'String::Flogger' } #pod =head2 env_prefix #pod #pod This method should return a string used as a prefix to find environment #pod variables that affect the logger's behavior. For example, if this method #pod returns C then when checking the environment for a default value for the #pod C parameter, Log::Dispatchouli will first check C, then #pod C. #pod #pod By default, this method returns C<()>, which means no extra environment #pod variable is checked. #pod #pod =cut sub env_prefix { return; } #pod =head2 env_value #pod #pod my $value = $logger->env_value('DEBUG'); #pod #pod This method returns the value for the environment variable suffix given. For #pod example, the example given, calling with C will check #pod C. #pod #pod =cut sub env_value { my ($self, $suffix) = @_; my @path = grep { defined } ($self->env_prefix, 'DISPATCHOULI'); for my $prefix (@path) { my $name = join q{_}, $prefix, $suffix; return $ENV{ $name } if defined $ENV{ $name }; } return; } #pod =head1 METHODS FOR TESTING #pod #pod =head2 new_tester #pod #pod my $logger = Log::Dispatchouli->new_tester( \%arg ); #pod #pod This returns a new logger that logs only C. It's useful in testing. #pod If no C arg is provided, one will be generated. C is off by #pod default, but can be overridden. #pod #pod C<\%arg> is optional. #pod #pod =cut sub new_tester { my ($class, $arg) = @_; $arg ||= {}; return $class->new({ ident => "$$:$0", log_pid => 0, %$arg, to_stderr => 0, to_stdout => 0, to_file => 0, to_self => 1, facility => undef, }); } #pod =head2 events #pod #pod This method returns the arrayref of events logged to an array in memory (in the #pod logger). If the logger is not logging C this raises an exception. #pod #pod =cut sub events { Carp::confess "->events called on a logger not logging to self" unless $_[0]->{events}; return $_[0]->{events}; } #pod =head2 clear_events #pod #pod This method empties the current sequence of events logged into an array in #pod memory. If the logger is not logging C this raises an exception. #pod #pod =cut sub clear_events { Carp::confess "->events called on a logger not logging to self" unless $_[0]->{events}; @{ $_[0]->{events} } = (); return; } #pod =head1 METHODS FOR PROXY LOGGERS #pod #pod =head2 proxy #pod #pod my $proxy_logger = $logger->proxy( \%arg ); #pod #pod This method returns a new proxy logger -- an instance of #pod L -- which will log through the given logger, but #pod which may have some settings localized. #pod #pod C<%arg> is optional. It may contain the following entries: #pod #pod =for :list #pod = proxy_prefix #pod This is a prefix that will be applied to anything the proxy logger logs, and #pod cannot be changed. #pod = proxy_ctx #pod This is data to be inserted in front of event data logged through the proxy. #pod It will appear I the C key but before the logged event data. It #pod can be in the same format as the C<$data_ref> argument to C. #pod = debug #pod This can be set to true or false to change the proxy's "am I in debug mode?" #pod setting. It can be changed or cleared later on the proxy. #pod #pod =cut sub proxy_class { return 'Log::Dispatchouli::Proxy'; } sub proxy { my ($self, $arg) = @_; $arg ||= {}; my $proxy = $self->proxy_class->_new({ parent => $self, logger => $self, proxy_prefix => $arg->{proxy_prefix}, (exists $arg->{debug} ? (debug => ($arg->{debug} ? 1 : 0)) : ()), }); if (my $ctx = $arg->{proxy_ctx}) { $proxy->{proxy_ctx} = _ARRAY0($ctx) ? [ @$ctx ] : [ $ctx->%{ sort keys %$ctx } ]; } return $proxy; } #pod =head2 parent #pod #pod =head2 logger #pod #pod These methods return the logger itself. (They're more useful when called on #pod proxy loggers.) #pod #pod =cut sub parent { $_[0] } sub logger { $_[0] } #pod =method dispatcher #pod #pod This returns the underlying Log::Dispatch object. This is not the method #pod you're looking for. Move along. #pod #pod =cut sub dispatcher { $_[0]->{dispatcher} } #pod =method stdio_dispatcher_class #pod #pod This method is an experimental feature to allow you to pick an alternate #pod dispatch class for stderr and stdio. By default, Log::Dispatch::Screen is #pod used. B #pod #pod =cut sub stdio_dispatcher_class { require Log::Dispatch::Screen; return 'Log::Dispatch::Screen'; } #pod =head1 METHODS FOR API COMPATIBILITY #pod #pod To provide compatibility with some other loggers, most specifically #pod L, the following methods are provided. You should not use #pod these methods without a good reason, and you should never subclass them. #pod Instead, subclass the methods they call. #pod #pod =begin :list #pod #pod = is_debug #pod #pod This method calls C. #pod #pod = is_info #pod #pod = is_fatal #pod #pod These methods return true. #pod #pod = info #pod #pod = fatal #pod #pod = debug #pod #pod These methods redispatch to C, C, and C #pod respectively. #pod #pod =end :list #pod #pod =cut sub is_debug { $_[0]->get_debug } sub is_info { 1 } sub is_fatal { 1 } sub info { shift()->log(@_); } sub fatal { shift()->log_fatal(@_); } sub debug { shift()->log_debug(@_); } use overload '&{}' => sub { my ($self) = @_; sub { $self->log(@_) } }, fallback => 1, ; #pod =head1 SEE ALSO #pod #pod =for :list #pod * L #pod * L #pod #pod =cut 1; __END__ =pod =encoding UTF-8 =head1 NAME Log::Dispatchouli - a simple wrapper around Log::Dispatch =head1 VERSION version 3.007 =head1 SYNOPSIS my $logger = Log::Dispatchouli->new({ ident => 'stuff-purger', facility => 'daemon', to_stdout => $opt->{print}, debug => $opt->{verbose} }); $logger->log([ "There are %s items left to purge...", $stuff_left ]); $logger->log_debug("this is extra often-ignored debugging log"); $logger->log_fatal("Now we will die!!"); =head1 DESCRIPTION Log::Dispatchouli is a thin layer above L and meant to make it dead simple to add logging to a program without having to think much about categories, facilities, levels, or things like that. It is meant to make logging just configurable enough that you can find the logs you want and just easy enough that you will actually log things. Log::Dispatchouli can log to syslog (if you specify a facility), standard error or standard output, to a file, or to an array in memory. That last one is mostly useful for testing. In addition to providing as simple a way to get a handle for logging operations, Log::Dispatchouli uses L to process the things to be logged, meaning you can easily log data structures. Basically: strings are logged as is, arrayrefs are taken as (sprintf format, args), and subroutines are called only if needed. For more information read the L docs. =head1 PERL VERSION This library should run on perls released even a long time ago. It should work on any version of perl released in the last five years. Although it may work on older versions of perl, no guarantee is made that the minimum required version will not be increased. The version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl. =head1 METHODS =head2 new my $logger = Log::Dispatchouli->new(\%arg); This returns a new logger, a Log::Dispatchouli object. Valid arguments are: ident - the name of the thing logging (mandatory) to_self - log to the logger object for testing; default: false to_stdout - log to STDOUT; default: false to_stderr - log to STDERR; default: false facility - to which syslog facility to send logs; default: none to_file - log to PROGRAM_NAME.YYYYMMDD in the log path; default: false log_file - a leaf name for the file to log to with to_file log_path - path in which to log to file; defaults to DISPATCHOULI_PATH environment variable or, failing that, to your system's tmpdir file_format - this optional coderef is passed the message to be logged and returns the text to write out log_pid - if true, prefix all log entries with the pid; default: true fail_fatal - a boolean; if true, failure to log is fatal; default: true muted - a boolean; if true, only fatals are logged; default: false debug - a boolean; if true, log_debug method is not a no-op defaults to the truth of the DISPATCHOULI_DEBUG env var quiet_fatal - 'stderr' or 'stdout' or an arrayref of zero, one, or both fatal log messages will not be logged to these (default: stderr) config_id - a name for this logger's config; rarely needed! syslog_socket - a value for Sys::Syslog's "socket" arg; default: "native" The log path is either F or the value of the F env var. If the F env var is true, we don't log to syslog. =head2 log $logger->log(@messages); $logger->log(\%arg, @messages); This method uses L on the input, then I logs the result. Each message is flogged individually, then joined with spaces. If the first argument is a hashref, it will be used as extra arguments to logging. It may include a C entry to preprocess the message by prepending a string (if the prefix is a string) or calling a subroutine to generate a new message (if the prefix is a coderef). =head2 log_fatal This behaves like the C method, but will throw the logged string as an exception after logging. This method can also be called as C, to match other popular logging interfaces. B and not C>. =head2 log_debug This behaves like the C method, but will only log (at the debug level) if the logger object has its debug property set to true. This method can also be called as C, to match other popular logging interfaces. B and not C>. =head2 log_event This method is like C, but is used for structured logging instead of free form text. It's invoked like this: $logger->log($event_type => $data_ref); C<$event_type> should be a simple string, probably a valid identifier, that identifies the kind of event being logged. It is suggested, but not required, that all events of the same type have the same kind of structured data in them. C<$data_ref> is a set of key/value pairs of data to log in this event. It can be an arrayref (in which case the ordering of pairs is preserved) or a hashref (in which case they are sorted by key). The logged string will be in logfmt format, meaning a series of key=value pairs separated by spaces and following these rules: =over 4 =item * an "identifier" is a string of printable ASCII characters between C and C<~>, excluding C<\> and C<=> =item * keys must be valid identifiers =item * if a key is empty, C<~> is used instead =item * if a key contains characters not permitted in an identifier, they are replaced by C =item * values must I be valid identifiers, or be quoted =item * quoted value start and end with C<"> =item * in a quoted value, C<"> becomes C<\">, C<\> becomes C<\\>, newline and carriage return become C<\n> and C<\r> respectively, and other control characters are replaced with C<\u{....}> where the contents of the braces are the hex value of the control character =back When values are undef, they are represented as C<~>. When values are array references, the index/values are mapped over, so that: key => [ 'a', 'b' ] becomes key.0=a key.1=b When values are hash references, the key/values are mapped, with keys sorted, so that: key => { b => 2, a => 1 } becomes key.a=1 key.b=2 This expansion is performed recursively. If a value itself recurses, appearances of a reference after the first time will be replaced with a string like C<&foo.bar>, pointing to the first occurrence. I It's just here to help you be a little lazy. Don't push the limits. If the value in C<$data_ref> is a code reference, it will be called and its result logged. If its result is also a code reference, you get whatever garbage that code reference stringifies to. If the value in C<$data_ref> is a reference reference, then the referenced scalar will be passed to String::Flogger, and the resulting string will be used as the value to log. That string will be quoted as described above, if needed. =head2 log_debug_event This method is just like C, but will log nothing unless the logger has its C property set to true. =head2 set_debug $logger->set_debug($bool); This sets the logger's debug property, which affects the behavior of C. =head2 get_debug This gets the logger's debug property, which affects the behavior of C. =head2 clear_debug This method does nothing, and is only useful for L objects. See L, below. =head2 set_muted $logger->set_muted($bool); This sets the logger's muted property, which affects the behavior of C. =head2 get_muted This gets the logger's muted property, which affects the behavior of C. =head2 clear_muted This method does nothing, and is only useful for L objects. See L, below. =head2 get_prefix my $prefix = $logger->get_prefix; This method returns the currently-set prefix for the logger, which may be a string or code reference or undef. See L. =head2 set_prefix $logger->set_prefix( $new_prefix ); This method changes the prefix. See L. =head2 clear_prefix This method clears any set logger prefix. (It can also be called as C, but this is deprecated. See L. =head2 ident This method returns the logger's ident. =head2 config_id This method returns the logger's configuration id, which defaults to its ident. This can be used to make two loggers equivalent in Log::Dispatchouli::Global so that trying to reinitialize with a new logger with the same C as the current logger will not throw an exception, and will simply do no thing. =head2 dispatcher This returns the underlying Log::Dispatch object. This is not the method you're looking for. Move along. =head2 stdio_dispatcher_class This method is an experimental feature to allow you to pick an alternate dispatch class for stderr and stdio. By default, Log::Dispatch::Screen is used. B =head1 LOGGER PREFIX Log messages may be prepended with information to set context. This can be set at a logger level or per log item. The simplest example is: my $logger = Log::Dispatchouli->new( ... ); $logger->set_prefix("Batch 123: "); $logger->log("begun processing"); # ... $logger->log("finished processing"); The above will log something like: Batch 123: begun processing Batch 123: finished processing To pass a prefix per-message: $logger->log({ prefix => 'Sub-Item 234: ' }, 'error!') # Logs: Batch 123: Sub-Item 234: error! If the prefix is a string, it is prepended to each line of the message. If it is a coderef, it is called and passed the message to be logged. The return value is logged instead. L also have their own prefix settings, which accumulate. So: my $proxy = $logger->proxy({ proxy_prefix => 'Subsystem 12: ' }); $proxy->set_prefix('Page 9: '); $proxy->log({ prefix => 'Paragraph 6: ' }, 'Done.'); ...will log... Batch 123: Subsystem 12: Page 9: Paragraph 6: Done. =head1 METHODS FOR SUBCLASSING =head2 string_flogger This method returns the thing on which F will be called to format log messages. By default, it just returns C =head2 env_prefix This method should return a string used as a prefix to find environment variables that affect the logger's behavior. For example, if this method returns C then when checking the environment for a default value for the C parameter, Log::Dispatchouli will first check C, then C. By default, this method returns C<()>, which means no extra environment variable is checked. =head2 env_value my $value = $logger->env_value('DEBUG'); This method returns the value for the environment variable suffix given. For example, the example given, calling with C will check C. =head1 METHODS FOR TESTING =head2 new_tester my $logger = Log::Dispatchouli->new_tester( \%arg ); This returns a new logger that logs only C. It's useful in testing. If no C arg is provided, one will be generated. C is off by default, but can be overridden. C<\%arg> is optional. =head2 events This method returns the arrayref of events logged to an array in memory (in the logger). If the logger is not logging C this raises an exception. =head2 clear_events This method empties the current sequence of events logged into an array in memory. If the logger is not logging C this raises an exception. =head1 METHODS FOR PROXY LOGGERS =head2 proxy my $proxy_logger = $logger->proxy( \%arg ); This method returns a new proxy logger -- an instance of L -- which will log through the given logger, but which may have some settings localized. C<%arg> is optional. It may contain the following entries: =over 4 =item proxy_prefix This is a prefix that will be applied to anything the proxy logger logs, and cannot be changed. =item proxy_ctx This is data to be inserted in front of event data logged through the proxy. It will appear I the C key but before the logged event data. It can be in the same format as the C<$data_ref> argument to C. =item debug This can be set to true or false to change the proxy's "am I in debug mode?" setting. It can be changed or cleared later on the proxy. =back =head2 parent =head2 logger These methods return the logger itself. (They're more useful when called on proxy loggers.) =head1 METHODS FOR API COMPATIBILITY To provide compatibility with some other loggers, most specifically L, the following methods are provided. You should not use these methods without a good reason, and you should never subclass them. Instead, subclass the methods they call. =over 4 =item is_debug This method calls C. =item is_info =item is_fatal These methods return true. =item info =item fatal =item debug These methods redispatch to C, C, and C respectively. =back =head1 SEE ALSO =over 4 =item * L =item * L =back =head1 AUTHOR Ricardo SIGNES =head1 CONTRIBUTORS =for stopwords Charlie Garrison Christopher J. Madsen Dagfinn Ilmari Mannsåker Dan Book George Hartzell Jon Stuart Matt Phillips Olivier Mengué Randy Stauner Ricardo Signes Sawyer X =over 4 =item * Charlie Garrison =item * Christopher J. Madsen =item * Dagfinn Ilmari Mannsåker =item * Dan Book =item * George Hartzell =item * Jon Stuart =item * Matt Phillips =item * Olivier Mengué =item * Randy Stauner =item * Ricardo Signes =item * Ricardo Signes =item * Sawyer X =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2023 by Ricardo SIGNES. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Log-Dispatchouli-3.007/lib/Log/Dispatchouli/Global.pm000644 000765 000024 00000033571 14474750275 022502 0ustar00rjbsstaff000000 000000 use strict; use warnings; package Log::Dispatchouli::Global 3.007; # ABSTRACT: a system for sharing a global, dynamically-scoped logger use Carp (); use Log::Dispatchouli; use Scalar::Util (); use Sub::Exporter::GlobExporter 0.002 qw(glob_exporter); # pass-through args use Sub::Exporter -setup => { collectors => { '$Logger' => glob_exporter(Logger => \'_build_logger'), }, }; #pod =head1 DESCRIPTION #pod #pod B: This interface is still experimental. #pod #pod Log::Dispatchouli::Global is a framework for a global logger object. In your #pod top-level programs that are actually executed, you'd add something like this: #pod #pod use Log::Dispatchouli::Global '$Logger' => { #pod init => { #pod ident => 'My::Daemon', #pod facility => 'local2', #pod to_stdout => 1, #pod }, #pod }; #pod #pod This will import a C<$Logger> into your program, and more importantly will #pod initialize it with a new L object created by passing the #pod value for the C parameter to Log::Dispatchouli's C method. #pod #pod Much of the rest of your program, across various libraries, can then just use #pod this: #pod #pod use Log::Dispatchouli::Global '$Logger'; #pod #pod sub whatever { #pod ... #pod #pod $Logger->log("about to do something"); #pod #pod local $Logger = $Logger->proxy({ proxy_prefix => "whatever: " }); #pod #pod for (@things) { #pod $Logger->log([ "doing thing %s", $_ ]); #pod ... #pod } #pod } #pod #pod This eliminates the need to pass around what is effectively a global, while #pod still allowing it to be specialized within certain contexts of your program. #pod #pod B Although you I just use Log::Dispatchouli::Global as your #pod shared logging library, you almost I want to write a subclass that #pod will only be shared amongst your application's classes. #pod Log::Dispatchouli::Global is meant to be subclassed and shared only within #pod controlled systems. Remember, I. #pod #pod =head1 USING #pod #pod In general, you will either be using a Log::Dispatchouli::Global class to get #pod a C<$Logger> or to initialize it (and then get C<$Logger>). These are both #pod demonstrated above. Also, when importing C<$Logger> you may request it be #pod imported under a different name: #pod #pod use Log::Dispatchouli::Global '$Logger' => { -as => 'L' }; #pod #pod $L->log( ... ); #pod #pod There is only one class method that you are likely to use: C. #pod This provides the value of the shared logger from the caller's context, #pod initializing it to a default if needed. Even this method is unlikely to be #pod required frequently, but it I allow users to I C<$Logger> without #pod importing it. #pod #pod =head1 SUBCLASSING #pod #pod Before using Log::Dispatchouli::Global in your application, you should subclass #pod it. When you subclass it, you should provide the following methods: #pod #pod =head2 logger_globref #pod #pod This method should return a globref in which the shared logger will be stored. #pod Subclasses will be in their own package, so barring any need for cleverness, #pod every implementation of this method can look like the following: #pod #pod sub logger_globref { no warnings 'once'; return \*Logger } #pod #pod =cut sub logger_globref { no warnings 'once'; \*Logger; } sub current_logger { my ($self) = @_; my $globref = $self->logger_globref; unless (defined $$$globref) { $$$globref = $self->default_logger; } return $$$globref; } #pod =head2 default_logger #pod #pod If no logger has been initialized, but something tries to log, it gets the #pod default logger, created by calling this method. #pod #pod The default implementation calls C on the C with the #pod result of C as the arguments. #pod #pod =cut sub default_logger { my ($self) = @_; my $ref = $self->default_logger_ref; $$ref ||= $self->default_logger_class->new( $self->default_logger_args ); } #pod =head2 default_logger_class #pod #pod This returns the class on which C will be called when initializing a #pod logger, either from the C argument when importing or the default logger. #pod #pod Its default value is Log::Dispatchouli. #pod #pod =cut sub default_logger_class { 'Log::Dispatchouli' } #pod =head2 default_logger_args #pod #pod If no logger has been initialized, but something tries to log, it gets the #pod default logger, created by calling C on the C and #pod passing the results of calling this method. #pod #pod Its default return value creates a sink, so that anything logged without an #pod initialized logger is lost. #pod #pod =cut sub default_logger_args { return { ident => "default/$0", facility => undef, } } #pod =head2 default_logger_ref #pod #pod This method returns a scalar reference in which the cached default value is #pod stored for comparison. This is used when someone tries to C the global. #pod When someone tries to initialize the global logger, and it's already set, then: #pod #pod =for :list #pod * if the current value is the same as the default, the new value is set #pod * if the current value is I the same as the default, we die #pod #pod Since you want the default to be isolated to your application's logger, the #pod default behavior is default loggers are associated with the glob reference to #pod which the default might be assigned. It is unlikely that you will need to #pod interact with this method. #pod #pod =cut my %default_logger_for_glob; sub default_logger_ref { my ($self) = @_; my $glob = $self->logger_globref; my $addr = Scalar::Util::refaddr($glob); return \$default_logger_for_glob{ $addr }; } sub _equiv { my ($self, $x, $y) = @_; return 1 if Scalar::Util::refaddr($x) == Scalar::Util::refaddr($y); return 1 if $x->config_id eq $y->config_id; return } sub _build_logger { my ($self, $arg) = @_; my $globref = $self->logger_globref; my $default = $self->default_logger; my $Logger = $$$globref; if ($arg and $arg->{init}) { my $new_logger = $self->default_logger_class->new($arg->{init}); if ($Logger and not( $self->_equiv($Logger, $new_logger) or $self->_equiv($Logger, $default) ) ) { # We already set up a logger, so we'll check that our new one is # equivalent to the old. If so, we'll keep the old, since it's good # enough. If not, we'll raise an exception: you can't configure the # logger twice, with different configurations, in one program! # -- rjbs, 2011-01-21 my $old = $Logger->config_id; my $new = $new_logger->config_id; Carp::confess(sprintf( "attempted to initialize %s logger twice; old config %s, new config %s", $self, $old, $new, )); } $$$globref = $new_logger; } else { $$$globref ||= $default; } return $globref; } #pod =head1 COOKBOOK #pod #pod =head2 Common Logger Recipes #pod #pod Say you often use the same configuration for one kind of program, like #pod automated tests. You've already written your own subclass to get your own #pod storage and defaults, maybe C. #pod #pod You can't just write a subclass with a different default, because if another #pod class using the same global has set the global with I default, yours won't #pod be honored. You don't just want this new value to be the default, you want it #pod to be I logger. What you want to do in this case is to initialize your #pod logger normally, then reexport it, like this: #pod #pod package MyApp::Logger::Test; #pod use parent 'MyApp::Logger'; #pod #pod use MyApp::Logger '$Logger' => { #pod init => { #pod ident => "Tester($0)", #pod to_self => 1, #pod facility => undef, #pod }, #pod }; #pod #pod This will set up the logger and re-export it, and will properly die if anything #pod else attempts to initialize the logger to something else. #pod #pod =cut 1; __END__ =pod =encoding UTF-8 =head1 NAME Log::Dispatchouli::Global - a system for sharing a global, dynamically-scoped logger =head1 VERSION version 3.007 =head1 DESCRIPTION B: This interface is still experimental. Log::Dispatchouli::Global is a framework for a global logger object. In your top-level programs that are actually executed, you'd add something like this: use Log::Dispatchouli::Global '$Logger' => { init => { ident => 'My::Daemon', facility => 'local2', to_stdout => 1, }, }; This will import a C<$Logger> into your program, and more importantly will initialize it with a new L object created by passing the value for the C parameter to Log::Dispatchouli's C method. Much of the rest of your program, across various libraries, can then just use this: use Log::Dispatchouli::Global '$Logger'; sub whatever { ... $Logger->log("about to do something"); local $Logger = $Logger->proxy({ proxy_prefix => "whatever: " }); for (@things) { $Logger->log([ "doing thing %s", $_ ]); ... } } This eliminates the need to pass around what is effectively a global, while still allowing it to be specialized within certain contexts of your program. B Although you I just use Log::Dispatchouli::Global as your shared logging library, you almost I want to write a subclass that will only be shared amongst your application's classes. Log::Dispatchouli::Global is meant to be subclassed and shared only within controlled systems. Remember, I. =head1 PERL VERSION This library should run on perls released even a long time ago. It should work on any version of perl released in the last five years. Although it may work on older versions of perl, no guarantee is made that the minimum required version will not be increased. The version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl. =head1 USING In general, you will either be using a Log::Dispatchouli::Global class to get a C<$Logger> or to initialize it (and then get C<$Logger>). These are both demonstrated above. Also, when importing C<$Logger> you may request it be imported under a different name: use Log::Dispatchouli::Global '$Logger' => { -as => 'L' }; $L->log( ... ); There is only one class method that you are likely to use: C. This provides the value of the shared logger from the caller's context, initializing it to a default if needed. Even this method is unlikely to be required frequently, but it I allow users to I C<$Logger> without importing it. =head1 SUBCLASSING Before using Log::Dispatchouli::Global in your application, you should subclass it. When you subclass it, you should provide the following methods: =head2 logger_globref This method should return a globref in which the shared logger will be stored. Subclasses will be in their own package, so barring any need for cleverness, every implementation of this method can look like the following: sub logger_globref { no warnings 'once'; return \*Logger } =head2 default_logger If no logger has been initialized, but something tries to log, it gets the default logger, created by calling this method. The default implementation calls C on the C with the result of C as the arguments. =head2 default_logger_class This returns the class on which C will be called when initializing a logger, either from the C argument when importing or the default logger. Its default value is Log::Dispatchouli. =head2 default_logger_args If no logger has been initialized, but something tries to log, it gets the default logger, created by calling C on the C and passing the results of calling this method. Its default return value creates a sink, so that anything logged without an initialized logger is lost. =head2 default_logger_ref This method returns a scalar reference in which the cached default value is stored for comparison. This is used when someone tries to C the global. When someone tries to initialize the global logger, and it's already set, then: =over 4 =item * if the current value is the same as the default, the new value is set =item * if the current value is I the same as the default, we die =back Since you want the default to be isolated to your application's logger, the default behavior is default loggers are associated with the glob reference to which the default might be assigned. It is unlikely that you will need to interact with this method. =head1 COOKBOOK =head2 Common Logger Recipes Say you often use the same configuration for one kind of program, like automated tests. You've already written your own subclass to get your own storage and defaults, maybe C. You can't just write a subclass with a different default, because if another class using the same global has set the global with I default, yours won't be honored. You don't just want this new value to be the default, you want it to be I logger. What you want to do in this case is to initialize your logger normally, then reexport it, like this: package MyApp::Logger::Test; use parent 'MyApp::Logger'; use MyApp::Logger '$Logger' => { init => { ident => "Tester($0)", to_self => 1, facility => undef, }, }; This will set up the logger and re-export it, and will properly die if anything else attempts to initialize the logger to something else. =head1 AUTHOR Ricardo SIGNES =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2023 by Ricardo SIGNES. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Log-Dispatchouli-3.007/lib/Log/Dispatchouli/Proxy.pm000644 000765 000024 00000013654 14474750275 022423 0ustar00rjbsstaff000000 000000 use v5.20; use warnings; package Log::Dispatchouli::Proxy 3.007; # ABSTRACT: a simple wrapper around Log::Dispatch use experimental 'postderef'; # Not dangerous. Is accepted without changed. use Log::Fmt (); use Params::Util qw(_ARRAY0 _HASH0); #pod =head1 DESCRIPTION #pod #pod A Log::Dispatchouli::Proxy object is the child of a L logger #pod (or another proxy) and relays log messages to its parent. It behaves almost #pod identically to a Log::Dispatchouli logger, and you should refer there for more #pod of its documentation. #pod #pod Here are the differences: #pod #pod =begin :list #pod #pod * You can't create a proxy with C<< ->new >>, only by calling C<< ->proxy >> on an existing logger or proxy. #pod #pod * C will set a value for the proxy; if none is set, C will check the parent's setting; C will clear any set value on this proxy #pod #pod * C messages will be redispatched to C (to the 'debug' logging level) to prevent parent loggers from dropping them due to C setting differences #pod #pod =end :list #pod #pod =cut sub _new { my ($class, $arg) = @_; my $guts = { parent => $arg->{parent}, logger => $arg->{logger}, debug => $arg->{debug}, proxy_prefix => $arg->{proxy_prefix}, proxy_ctx => $arg->{proxy_ctx}, }; bless $guts => $class; } sub proxy { my ($self, $arg) = @_; $arg ||= {}; my @proxy_ctx; if (my $ctx = $arg->{proxy_ctx}) { @proxy_ctx = _ARRAY0($ctx) ? (@proxy_ctx, @$ctx) : (@proxy_ctx, $ctx->%{ sort keys %$ctx }); } my $prox = (ref $self)->_new({ parent => $self, logger => $self->logger, debug => $arg->{debug}, muted => $arg->{muted}, proxy_prefix => $arg->{proxy_prefix}, proxy_ctx => \@proxy_ctx, }); } sub parent { $_[0]{parent} } sub logger { $_[0]{logger} } sub ident { $_[0]{logger}->ident } sub config_id { $_[0]{logger}->config_id } sub set_prefix { $_[0]{prefix} = $_[1] } sub get_prefix { $_[0]{prefix} } sub clear_prefix { undef $_[0]{prefix} } sub unset_prefix { $_[0]->clear_prefix } sub set_debug { $_[0]{debug} = $_[1] ? 1 : 0 } sub clear_debug { undef $_[0]{debug} } sub get_debug { return $_[0]{debug} if defined $_[0]{debug}; return $_[0]->parent->get_debug; } sub is_debug { $_[0]->get_debug } sub is_info { 1 } sub is_fatal { 1 } sub mute { $_[0]{muted} = 1 } sub unmute { $_[0]{muted} = 0 } sub set_muted { $_[0]{muted} = $_[1] ? 1 : 0 } sub clear_muted { undef $_[0]{muted} } sub _get_local_muted { $_[0]{muted} } sub get_muted { return $_[0]{muted} if defined $_[0]{muted}; return $_[0]->parent->get_muted; } sub _get_all_prefix { my ($self, $arg) = @_; return [ $self->{proxy_prefix}, $self->get_prefix, _ARRAY0($arg->{prefix}) ? @{ $arg->{prefix} } : $arg->{prefix} ]; } sub log { my ($self, @rest) = @_; my $arg = _HASH0($rest[0]) ? shift(@rest) : {}; return if $self->_get_local_muted and ! $arg->{fatal}; local $arg->{prefix} = $self->_get_all_prefix($arg); $self->parent->log($arg, @rest); } sub log_fatal { my ($self, @rest) = @_; my $arg = _HASH0($rest[0]) ? shift(@rest) : {}; local $arg->{fatal} = 1; $self->log($arg, @rest); } sub log_debug { my ($self, @rest) = @_; my $debug = $self->get_debug; return if defined $debug and ! $debug; my $arg = _HASH0($rest[0]) ? shift(@rest) : {}; local $arg->{level} = 'debug'; $self->log($arg, @rest); } sub _compute_proxy_ctx_kvstr_aref { my ($self) = @_; return $self->{proxy_ctx_kvstr} //= do { my @kvstr = $self->parent->_compute_proxy_ctx_kvstr_aref->@*; if ($self->{proxy_ctx}) { my $our_kv = Log::Fmt->_pairs_to_kvstr_aref($self->{proxy_ctx}); push @kvstr, @$our_kv; } \@kvstr; }; } sub log_event { my ($self, $event, $data) = @_; return if $self->get_muted; my $message = $self->logger->_log_event($event, $self->_compute_proxy_ctx_kvstr_aref, [ _ARRAY0($data) ? @$data : $data->%{ sort keys %$data } ] ); } sub log_debug_event { my ($self, $event, $data) = @_; return unless $self->get_debug; return $self->log_event($event, $data); } sub info { shift()->log(@_); } sub fatal { shift()->log_fatal(@_); } sub debug { shift()->log_debug(@_); } use overload '&{}' => sub { my ($self) = @_; sub { $self->log(@_) } }, fallback => 1, ; 1; __END__ =pod =encoding UTF-8 =head1 NAME Log::Dispatchouli::Proxy - a simple wrapper around Log::Dispatch =head1 VERSION version 3.007 =head1 DESCRIPTION A Log::Dispatchouli::Proxy object is the child of a L logger (or another proxy) and relays log messages to its parent. It behaves almost identically to a Log::Dispatchouli logger, and you should refer there for more of its documentation. Here are the differences: =over 4 =item * You can't create a proxy with C<< ->new >>, only by calling C<< ->proxy >> on an existing logger or proxy. =item * C will set a value for the proxy; if none is set, C will check the parent's setting; C will clear any set value on this proxy =item * C messages will be redispatched to C (to the 'debug' logging level) to prevent parent loggers from dropping them due to C setting differences =back =head1 PERL VERSION This library should run on perls released even a long time ago. It should work on any version of perl released in the last five years. Although it may work on older versions of perl, no guarantee is made that the minimum required version will not be increased. The version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl. =head1 AUTHOR Ricardo SIGNES =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2023 by Ricardo SIGNES. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Log-Dispatchouli-3.007/xt/author/000755 000765 000024 00000000000 14474750275 016751 5ustar00rjbsstaff000000 000000 Log-Dispatchouli-3.007/xt/release/000755 000765 000024 00000000000 14474750275 017067 5ustar00rjbsstaff000000 000000 Log-Dispatchouli-3.007/xt/release/changes_has_content.t000644 000765 000024 00000002101 14474750275 023243 0ustar00rjbsstaff000000 000000 use Test::More tests => 2; note 'Checking Changes'; my $changes_file = 'Changes'; my $newver = '3.007'; my $trial_token = '-TRIAL'; my $encoding = 'UTF-8'; SKIP: { ok(-e $changes_file, "$changes_file file exists") or skip 'Changes is missing', 1; ok(_get_changes($newver), "$changes_file has content for $newver"); } done_testing; sub _get_changes { my $newver = shift; # parse changelog to find commit message open(my $fh, '<', $changes_file) or die "cannot open $changes_file: $!"; my $changelog = join('', <$fh>); if ($encoding) { require Encode; $changelog = Encode::decode($encoding, $changelog, Encode::FB_CROAK()); } close $fh; my @content = grep { /^$newver(?:$trial_token)?(?:\s+|$)/ ... /^\S/ } # from newver to un-indented split /\n/, $changelog; shift @content; # drop the version line # drop unindented last line and trailing blank lines pop @content while ( @content && $content[-1] =~ /^(?:\S|\s*$)/ ); # return number of non-blank lines return scalar @content; } Log-Dispatchouli-3.007/xt/author/pod-syntax.t000644 000765 000024 00000000252 14474750275 021243 0ustar00rjbsstaff000000 000000 #!perl # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use strict; use warnings; use Test::More; use Test::Pod 1.41; all_pod_files_ok(); Log-Dispatchouli-3.007/t/global.t000644 000765 000024 00000001762 14474750275 016712 0ustar00rjbsstaff000000 000000 use strict; use warnings; use Test::Fatal; use Test::More; use Log::Dispatchouli::Global '$Logger' => { init => { ident => 't/global.t', log_pid => 0, to_self => 1, }}; { package Alpha; use Log::Dispatchouli::Global '$Logger'; sub call_bravo { my ($self, $n) = @_; local $Logger = $Logger->proxy({ proxy_prefix => "$n: " }); $Logger->log("inside call_bravo"); Bravo->endpoint; } } { package Bravo; use Log::Dispatchouli::Global '$Logger' => { -as => 'L' }; sub endpoint { my ($self, $n) = @_; $L->log("inside Bravo::endpoint"); } } isa_ok($Logger, 'Log::Dispatchouli', 'imported $Logger'); $Logger->log("first"); Alpha->call_bravo(123); $Logger->log("last"); my $events = $Logger->events; is($events->[0]->{message}, 'first', '1st log'); is($events->[1]->{message}, '123: inside call_bravo', '2nd log'); is($events->[2]->{message}, '123: inside Bravo::endpoint', '3rd log'); is($events->[3]->{message}, 'last', '4th log'); done_testing; Log-Dispatchouli-3.007/t/file.t000644 000765 000024 00000003005 14474750275 016361 0ustar00rjbsstaff000000 000000 use strict; use warnings; use Log::Dispatchouli; use Test::More 0.88; use File::Spec::Functions qw( catfile ); use File::Temp qw( tempdir ); my $tmpdir = tempdir( TMPDIR => 1, CLEANUP => 1 ); { { my $logger = Log::Dispatchouli->new({ log_pid => 1, ident => 't_file', to_file => 1, log_path => $tmpdir, }); isa_ok($logger, 'Log::Dispatchouli'); is($logger->ident, 't_file', '$logger->ident is available'); $logger->log([ "point: %s", {x=>1,y=>2} ]); } my ($log_file) = glob(catfile($tmpdir, 't_file.*')); ok -r $log_file, 'log file with ident name'; like slurp_file($log_file), qr/^.+? \[$$\] point: \{\{\{("[xy]": [12](, ?)?){2}\}\}\}$/, 'logged timestamp, pid, and hash'; } { { my $logger = Log::Dispatchouli->new({ log_pid => 0, ident => 'ouli_file', to_file => 1, log_file => 'ouli.log', log_path => $tmpdir, file_format => sub { "$$: sec:" . time() . " m:" . $_[0] }, }); isa_ok($logger, 'Log::Dispatchouli'); is($logger->ident, 'ouli_file', '$logger->ident is available'); $logger->log([ "point: %s", {x=>1,y=>2} ]); } my $log_file = catfile($tmpdir, 'ouli.log'); ok -r $log_file, 'log file with custom name'; like slurp_file($log_file), qr/^$$: sec:\d+ m:point: \{\{\{("[xy]": [12](, ?)?){2}\}\}\}$/, 'custom file callbacks'; } done_testing; sub slurp_file { my ($file) = @_; open my $fh, '<', $file or die "Failed to open $file: $!"; local $/; return <$fh>; } Log-Dispatchouli-3.007/t/events.t000644 000765 000024 00000023751 14474750275 016760 0ustar00rjbsstaff000000 000000 use strict; use warnings; use experimental 'postderef'; # Not dangerous. Is accepted without changed. use utf8; use JSON::MaybeXS; use Log::Dispatchouli; use Test::More 0.88; use Test::Deep; sub event_logs_ok { my ($event_type, $data, $line, $desc) = @_; local $Test::Builder::Level = $Test::Builder::Level+1; my $logger = Log::Dispatchouli->new_tester({ log_pid => 0, ident => 't/basic.t', }); $logger->log_event($event_type, $data); messages_ok($logger, [$line], $desc); } sub messages_ok { my ($logger, $lines, $desc) = @_; local $Test::Builder::Level = $Test::Builder::Level+1; my @messages = map {; $_->{message} } $logger->events->@*; my $ok = cmp_deeply( \@messages, $lines, $desc, ); $logger->clear_events; unless ($ok) { diag "GOT: $_" for @messages; } return $ok; } sub parse_event_ok { my ($event_string, $expect, $desc) = @_; local $Test::Builder::Level = $Test::Builder::Level+1; my $result = Log::Fmt->parse_event_string($event_string); cmp_deeply( $result, $expect, $desc, ) or note explain $result; } sub logger_trio { my $logger = Log::Dispatchouli->new_tester({ log_pid => 0, ident => 't/basic.t', }); my $proxy1 = $logger->proxy({ proxy_ctx => { 'outer' => 'proxy' } }); my $proxy2 = $proxy1->proxy({ proxy_ctx => { 'inner' => 'proxy' } }); return ($logger, $proxy1, $proxy2); } subtest "very basic stuff" => sub { event_logs_ok( 'world-series' => [ phl => 1, hou => 0, games => [ 'done', 'in-progress' ] ], 'event=world-series phl=1 hou=0 games.0=done games.1=in-progress', "basic data with an arrayref value", ); parse_event_ok( 'event=world-series phl=1 hou=0 games.0=done games.1=in-progress', [ event => 'world-series', phl => 1, hou => 0, 'games.0' => 'done', 'games.1' => 'in-progress', ], 'we can parse something we produced' ); event_logs_ok( 'programmer-sleepiness' => { weary => 8.62, excited => 3.2, motto => q{Never say "never" ever again.}, }, 'event=programmer-sleepiness excited=3.2 motto="Never say \\"never\\" ever again." weary=8.62', "basic data as a hashref", ); { my %kv = ( weary => 8.62, excited => 3.2, motto => q{Never say "never" ever again.}, ); my $line = Log::Fmt->format_event_string([%kv]); cmp_deeply( Log::Fmt->parse_event_string_as_hash($line), \%kv, "parse_event_string_as_hash works", ); } parse_event_ok( 'event=programmer-sleepiness excited=3.2 motto="Never say \\"never\\" ever again." weary=8.62', [ event => 'programmer-sleepiness', excited => '3.2', motto => q{Never say "never" ever again.}, weary => '8.62', ], "parse an event with simple quotes", ); event_logs_ok( 'rich-structure' => [ array => [ { name => [ qw(Ricardo Signes) ], limbs => { arms => 2, legs => 2 } }, [ 2, 4, 6 ], ], ], join(q{ }, qw( event=rich-structure array.0.limbs.arms=2 array.0.limbs.legs=2 array.0.name.0=Ricardo array.0.name.1=Signes array.1.0=2 array.1.1=4 array.1.2=6 )), "a structured nested a few levels", ); event_logs_ok( 'empty-key' => { '' => 'disgusting' }, 'event=empty-key ~=disgusting', "cope with jerks putting empty keys into the data structure", ); event_logs_ok( 'bogus-subkey' => { valid => { 'foo bar' => 'revolting' } }, 'event=bogus-subkey valid.foo?bar=revolting', "cope with bogus key characters in recursion", ); event_logs_ok( ctrlctl => [ string => qq{NL \x0a CR \x0d "Q" ZWJ \x{200D} \\nothing ë}, ], 'event=ctrlctl string="NL \\n CR \\r \\"Q\\" ZWJ \\x{200d} \\\\nothing ë"', 'control characters and otherwise', ); parse_event_ok( 'event=ctrlctl string="NL \\n CR \\r \\"Q\\" ZWJ \\x{200d} \\\\nothing ë"', [ event => 'ctrlctl', string => qq{NL \x0a CR \x0d "Q" ZWJ \x{200D} \\nothing ë}, ], "parse an event with simple quotes", ); event_logs_ok( spacey => [ string => qq{line \x{2028} spacer} ], 'event=spacey string="line \x{2028} spacer"', 'non-control non-ascii vertical whitespace is also escaped', ); parse_event_ok( 'event=spacey string="line \x{2028} spacer"', [ event => 'spacey', string => qq{line \x{2028} spacer} ], "parse an that has an escaped vertical whitespace cahracter", ); }; subtest "very basic proxy operation" => sub { my ($logger, $proxy1, $proxy2) = logger_trio(); $proxy2->log_event(pie_picnic => [ pies_eaten => 1.2, joy_harvested => 6, ]); messages_ok( $logger, [ 'event=pie_picnic outer=proxy inner=proxy pies_eaten=1.2 joy_harvested=6' ], 'got the expected log output from events', ); }; subtest "debugging in the proxies" => sub { my ($logger, $proxy1, $proxy2) = logger_trio(); $proxy1->set_debug(1); $logger->log_debug_event(0 => [ seq => 0 ]); $proxy1->log_debug_event(1 => [ seq => 1 ]); $proxy2->log_debug_event(2 => [ seq => 2 ]); $proxy2->set_debug(0); $logger->log_debug_event(0 => [ seq => 3 ]); $proxy1->log_debug_event(1 => [ seq => 4 ]); $proxy2->log_debug_event(2 => [ seq => 5 ]); messages_ok( $logger, [ # 'event=0 seq=0', # not logged, debugging 'event=1 outer=proxy seq=1', 'event=2 outer=proxy inner=proxy seq=2', # 'event=0 seq=3', # not logged, debugging 'event=1 outer=proxy seq=4', # 'event=2 outer=proxy inner=proxy seq=5', # not logged, debugging ], 'got the expected log output from events', ); }; # NOT TESTED HERE: "mute" and "unmute", which rjbs believes are probably # broken already. Their tests don't appear to test the important case of "root # logger muted, proxy explicitly unmuted". subtest "recursive structure" => sub { my ($logger, $proxy1, $proxy2) = logger_trio(); my $struct = {}; $struct->{recurse} = $struct; $logger->log_event('recursive-thing' => [ recursive => $struct ]); messages_ok( $logger, [ 'event=recursive-thing recursive.recurse=&recursive', ], "an event with recursive stuff terminates", ); }; subtest "lazy values" => sub { my ($logger) = logger_trio(); my $called = 0; my $callback = sub { $called++; return 'X' }; $logger->log_event('sub-caller' => [ once => $callback, twice => $callback, ]); $logger->log_debug_event('sub-caller' => [ d_once => $callback, d_twice => $callback, ]); messages_ok( $logger, [ 'event=sub-caller once=X twice=X', ], "we call sublike arguments to lazily compute", ); is($called, 2, "only called twice; debug events did not call sub"); }; subtest "lazy values in proxy context" => sub { my ($logger) = logger_trio(); my $called_A = 0; my $callback_A = sub { $called_A++; return 'X' }; my $called_B = 0; my $callback_B = sub { $called_B++; return 'X' }; my $proxy1 = $logger->proxy({ proxy_ctx => [ outer => $callback_A ] }); my $proxy2 = $proxy1->proxy({ proxy_ctx => [ inner => $callback_B ] }); $proxy1->log_event('outer-event' => [ guitar => 'electric' ]); is($called_A, 1, "outer proxy did log, called outer callback"); is($called_B, 0, "outer proxy did log, didn't call inner callback"); $proxy2->log_event('inner-event' => [ mandolin => 'bluegrass' ]); is($called_A, 1, "inner proxy did log, didn't re-call outer callback"); is($called_B, 1, "inner proxy did log, did call inner callback"); $proxy2->log_event('inner-second' => [ snare => 'infinite' ]); messages_ok( $logger, [ 'event=outer-event outer=X guitar=electric', 'event=inner-event outer=X inner=X mandolin=bluegrass', 'event=inner-second outer=X inner=X snare=infinite', ], "all our laziness didn't change our results", ); }; subtest "reused JSON booleans" => sub { # It's not that this is extremely special, but we mostly don't want to # recurse into the same reference value multiple times, but we also don't # want the infuriating "reused boolean variable" you get from Dumper. This # is just to make sure I don't accidentally break this case. my ($logger, $proxy1, $proxy2) = logger_trio(); my $struct = { b => [ JSON::MaybeXS::true(), JSON::MaybeXS::false() ], f => [ (JSON::MaybeXS::false()) x 3 ], t => [ (JSON::MaybeXS::true()) x 3 ], }; $logger->log_event('tf-thing' => [ cond => $struct ]); messages_ok( $logger, [ 'event=tf-thing cond.b.0=1 cond.b.1=0 cond.f.0=0 cond.f.1=0 cond.f.2=0 cond.t.0=1 cond.t.1=1 cond.t.2=1', ], "JSON bools do what we expect", ); }; subtest "JSON-ification of refrefs" => sub { my ($logger, $proxy1, $proxy2) = logger_trio(); $logger->log_event('json-demo' => [ foo => { a => 1 }, bar => \{ a => 1 }, baz => \[ 12, 34 ], ]); my @messages = map {; $_->{message} } $logger->events->@*; messages_ok( $logger, [ # XS and PP versions of JSON differ on space, so we need "12, 34" and # "12,34" both. Then things get weird, because the version with no # spaces (pure perl, at least as of today) doesn't need to be quoted to # be used as a logfmt value, so the quotes are now optional. Wild. # -- rjbs, 2023-09-02 any( 'event=json-demo foo.a=1 bar="{{{\"a\": 1}}}" baz="{{[12, 34]}}"', 'event=json-demo foo.a=1 bar="{{{\"a\": 1}}}" baz={{[12,34]}}', ), ], "refref becomes JSON flogged", ); my $result = Log::Fmt->parse_event_string($messages[0]); cmp_deeply( $result, [ event => 'json-demo', 'foo.a' => 1, bar => "{{{\"a\": 1}}}", baz => any("{{[12, 34]}}", "{{[12,34]}}"), ], "parsing gets us JSON string out, because it is just strings", ); my ($json_string) = $result->[5] =~ /\A\{\{(.+)\}\}\z/; my $json_struct = decode_json($json_string); cmp_deeply( $json_struct, { a => 1 }, "we can round trip that JSON", ); }; done_testing; Log-Dispatchouli-3.007/t/env-value.t000644 000765 000024 00000001733 14474750275 017352 0ustar00rjbsstaff000000 000000 #!perl use strict; use warnings; use Test::More; use Log::Dispatchouli; { package Xyzzy::Logger; use base 'Log::Dispatchouli'; sub env_prefix { 'XYZZY' } } { local $ENV{DISPATCHOULI_DEBUG} = 1; local $ENV{XYZZY_DEBUG} = 0; my $d_logger = Log::Dispatchouli->new_tester; my $x_logger = Xyzzy::Logger->new_tester; ok( $d_logger->is_debug, "DISPATCHOULI_ affects L::D logger"); ok( ! $x_logger->is_debug, "...but XYZZY_ overrides for X::L"); } { local $ENV{DISPATCHOULI_DEBUG} = 1; my $d_logger = Log::Dispatchouli->new_tester; my $x_logger = Xyzzy::Logger->new_tester; ok( $d_logger->is_debug, "DISPATCHOULI_ affects L::D logger"); ok( $x_logger->is_debug, "...and X::L will use it with no XYZZY_"); } { local $ENV{XYZZY_DEBUG} = 1; my $d_logger = Log::Dispatchouli->new_tester; my $x_logger = Xyzzy::Logger->new_tester; ok( $x_logger->is_debug, "XYZZY_ affects X::L"); ok( ! $d_logger->is_debug, "...but not L::D"); } done_testing; Log-Dispatchouli-3.007/t/basic.t000644 000765 000024 00000007637 14474750275 016542 0ustar00rjbsstaff000000 000000 use strict; use warnings; use Log::Dispatchouli; use Test::More 0.88; use Test::Deep; { my $logger = Log::Dispatchouli->new_tester({ log_pid => 1, ident => 't/basic.t', }); isa_ok($logger, 'Log::Dispatchouli'); is($logger->ident, 't/basic.t', '$logger->ident is available'); $logger->log([ "point: %s", {x=>1,y=>2} ]); $logger->log_debug('this will not get logged'); cmp_deeply( $logger->events, [ superhashof({ message => re(qr/$$.+\Qpoint: {{{"x": 1,\E\s?\Q"y": 2}}}\E\z/) }) ], "events with struts logged to self", ); eval { $logger->log_fatal([ 'this is good: %s', [ 1, 2, 3 ] ]) }; like($@, qr(good: \{\{\[), "log_fatal is fatal"); } { my $logger = Log::Dispatchouli->new_tester({ to_self => 1, log_pid => 0, }); isa_ok($logger, 'Log::Dispatchouli'); $logger->log([ "point: %s", {x=>1,y=>2} ]); $logger->log_debug('this will not get logged'); cmp_deeply( $logger->events, [ superhashof({ message => code(sub { index($_[0], $$) == -1 }), }) ], 'events with struts logged to self (no $$)', ); eval { $logger->log_fatal([ 'this is good: %s', [ 1, 2, 3 ] ]) }; like($@, qr(good: \{\{\[), "log_fatal is fatal"); } { my $logger = Log::Dispatchouli->new({ ident => 'foo', to_self => 1, log_pid => 0, }); $logger->log('foo'); cmp_deeply($logger->events, [ superhashof({ message =>'foo' }) ], 'log foo'); $logger->clear_events; cmp_deeply($logger->events, [ ], 'log empty after clear'); $logger->log('bar'); cmp_deeply($logger->events, [ superhashof({ message =>'bar' }) ], 'log bar'); $logger->log('foo'); cmp_deeply( $logger->events, [ superhashof({ message =>'bar' }), superhashof({ message =>'foo' }), ], 'log keeps accumulating', ); } { my $logger = Log::Dispatchouli->new({ ident => 'foo', to_self => 1, log_pid => 0, }); $logger->log([ '%s %s', '[foo]', [qw(foo)] ], ".."); is( $logger->events->[0]{message}, '[foo] {{["foo"]}} ..', "multi-arg logging", ); $logger->set_prefix('xyzzy: '); $logger->log('foo'); $logger->clear_prefix; $logger->log('bar'); is($logger->events->[1]{message}, 'xyzzy: foo', 'set a prefix'); is($logger->events->[2]{message}, 'bar', 'clear prefix'); } { my $logger = eval { Log::Dispatchouli->new; }; like($@, qr/no ident specified/, "can't make a logger without ident"); } { my $logger = Log::Dispatchouli->new({ ident => 'foo', to_self => 1, log_pid => 0, }); $logger->log({ prefix => '[ALERT] ' }, "foo\nbar\nbaz"); my $want_0 = <<'END_LOG'; [ALERT] foo [ALERT] bar [ALERT] baz END_LOG chomp $want_0; $logger->log( { prefix => sub { my $m = shift; my @lines = split /\n/, $m; $lines[0] = "<<< $lines[0]"; $lines[1] = "||| $lines[1]"; $lines[2] = ">>> $lines[2]"; return join "\n", @lines; }, }, "foo\nbar\nbaz", ); my $want_1 = <<'END_LOG'; <<< foo ||| bar >>> baz END_LOG chomp $want_1; is( $logger->events->[0]{message}, $want_0, "multi-line and prefix (string)", ); is( $logger->events->[1]{message}, $want_1, "multi-line and prefix (code)", ); } { my $logger = Log::Dispatchouli->new_tester({ debug => 1 }); $logger->log('info'); $logger->log('debug'); cmp_deeply( $logger->events, [ superhashof({ message => 'info' }), superhashof({ message => 'debug' }), ], 'info and debug while not muted', ); $logger->clear_events; $logger->mute; $logger->log('info'); $logger->log('debug'); cmp_deeply($logger->events, [ ], 'nothing logged while muted'); ok( ! eval { $logger->log_fatal('fatal'); 1}, "log_fatal still dies while muted", ); cmp_deeply( $logger->events, [ superhashof({ message => 'fatal' }) ], 'logged a fatal even while muted' ); } done_testing; Log-Dispatchouli-3.007/t/proxy.t000644 000765 000024 00000006046 14474750275 016633 0ustar00rjbsstaff000000 000000 use strict; use warnings; use Log::Dispatchouli; use Test::More 0.88; my $logger = Log::Dispatchouli->new_tester({ ident => 't/proxy.t', }); sub are_events { my ($comment, $want) = @_; my @have = map { $_->{message} } @{ $logger->events }; $logger->clear_events; is_deeply(\@have, $want, $comment); } $logger->log("1"); is($logger->ident, 't/proxy.t', '$logger->ident is available'); are_events("we can log a simple event", [ '1' ]); $logger->set_prefix("A: "); $logger->log("2"); are_events("simple log with prefix", [ 'A: 2', ]); my $proxy = $logger->proxy({ proxy_prefix => 'B: ', }); is($proxy->ident, 't/proxy.t', '$proxy->ident is available'); $proxy->log("3"); are_events("log with proxy with prefix", [ 'A: B: 3', ]); $proxy->("4"); are_events("proxy log overloading", [ 'A: B: 4', ]); $proxy->set_prefix('C: '); $proxy->log("4"); $proxy->log({ prefix => 'D: ' }, "5"); are_events("log with proxy with prefix", [ 'A: B: C: 4', 'A: B: C: D: 5', ]); $logger->clear_prefix; $proxy->log("4"); $proxy->log({ prefix => 'D: ' }, "5"); are_events("remove the logger's parent's prefix", [ 'B: C: 4', 'B: C: D: 5', ]); $logger->set_prefix('A: '); my $proxprox = $proxy->proxy({ proxy_prefix => 'E: ', }); $proxprox->log("6"); $proxprox->set_prefix('F: '); $proxprox->log("7"); $proxprox->log({ prefix => 'G: ' }, "8"); are_events("second-order proxy, basic logging", [ 'A: B: C: E: 6', 'A: B: C: E: F: 7', 'A: B: C: E: F: G: 8', ]); $logger->log_debug("logger debug"); $proxy->log_debug("proxy debug"); $proxprox->log_debug("proxprox debug"); are_events("no debugging on at first", [ ]); $proxy->set_debug(1); $logger->log_debug("logger debug"); $proxy->log_debug("proxy debug"); $proxprox->log_debug("proxprox debug"); are_events("debugging in middle tier (middle set_debug)", [ 'A: B: C: proxy debug', 'A: B: C: E: F: proxprox debug', ]); $proxprox->set_debug(0); $logger->log_debug("logger debug"); $proxy->log_debug("proxy debug"); $proxprox->log_debug("proxprox debug"); are_events("debugging in middle tier", [ 'A: B: C: proxy debug', ]); sub unmute_all { $_->clear_muted for ($proxy, $proxprox); $logger->unmute; }; unmute_all; $proxprox->mute; $proxprox->log("proxprox"); $proxy->log("proxy"); $logger->log("logger"); are_events("only muted proxprox", [ 'A: B: C: proxy', 'A: logger', ]); unmute_all; $proxy->mute; $proxprox->log("proxprox"); $proxy->log("proxy"); $logger->log("logger"); are_events("muted proxy", [ 'A: logger', ]); unmute_all; $proxprox->unmute; $proxy->mute; $proxprox->log("proxprox"); $proxy->log("proxy"); $logger->log("logger"); are_events("muted proxy, unmuted proxprox", [ 'A: logger', ]); ok($logger->logger == $logger, "logger->logger == logger"); ok($proxy->logger == $logger, "proxy->logger == logger"); ok($proxprox->logger == $logger, "proxprox->logger == logger"); ok($logger->parent == $logger, "logger->parent == logger"); ok($proxy->parent == $logger, "proxy->parent == logger"); ok($proxprox->parent == $proxy, "proxprox->parent == proxy"); done_testing; Log-Dispatchouli-3.007/t/global-subclass.t000644 000765 000024 00000002046 14474750275 020523 0ustar00rjbsstaff000000 000000 use strict; use warnings; use Test::More; use Scalar::Util qw(refaddr); use lib 't/lib'; # DDR - default default ref -- uses the default default_logger_ref { package DDR_P; use DDR::Parent '$Logger'; } { package DDR_C; use DDR::Child '$Logger'; } # SDR - shared default ref -- uses a default_logger_ref shared between classes { package SDR_P; use SDR::Parent '$Logger'; } { package SDR_C; use SDR::Child '$Logger'; } is( refaddr( $DDR_P::Logger ), refaddr( $DDR_C::Logger ), "DDR parent and child share logger storage", ); # DDR::Child can store its default in a different place, but # $DDR::Parent::Logger is already defined when we get here, so the logic is # "already defined and not equal to *my* default, so it is untouched." is($DDR_P::Logger->ident, 'DDR::Parent', "parent won the initialization race"); is( refaddr( $SDR_P::Logger ), refaddr( $SDR_C::Logger ), "SDR parent and child share logger storage", ); is( $SDR_P::Logger->ident, 'SDR::Parent', "SDR::Parent is initialized first, so its default wins", ); done_testing; Log-Dispatchouli-3.007/t/00-report-prereqs.t000644 000765 000024 00000013601 14474750275 020654 0ustar00rjbsstaff000000 000000 #!perl use strict; use warnings; # This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.029 use Test::More tests => 1; use ExtUtils::MakeMaker; use File::Spec; # from $version::LAX my $lax_version_re = qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )? | (?:\.[0-9]+) (?:_[0-9]+)? ) | (?: v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )? | (?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)? ) )/x; # hide optional CPAN::Meta modules from prereq scanner # and check if they are available my $cpan_meta = "CPAN::Meta"; my $cpan_meta_pre = "CPAN::Meta::Prereqs"; my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic # Verify requirements? my $DO_VERIFY_PREREQS = 1; sub _max { my $max = shift; $max = ( $_ > $max ) ? $_ : $max for @_; return $max; } sub _merge_prereqs { my ($collector, $prereqs) = @_; # CPAN::Meta::Prereqs object if (ref $collector eq $cpan_meta_pre) { return $collector->with_merged_prereqs( CPAN::Meta::Prereqs->new( $prereqs ) ); } # Raw hashrefs for my $phase ( keys %$prereqs ) { for my $type ( keys %{ $prereqs->{$phase} } ) { for my $module ( keys %{ $prereqs->{$phase}{$type} } ) { $collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module}; } } } return $collector; } my @include = qw( ); my @exclude = qw( ); # Add static prereqs to the included modules list my $static_prereqs = do './t/00-report-prereqs.dd'; # Merge all prereqs (either with ::Prereqs or a hashref) my $full_prereqs = _merge_prereqs( ( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ), $static_prereqs ); # Add dynamic prereqs to the included modules list (if we can) my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; my $cpan_meta_error; if ( $source && $HAS_CPAN_META && (my $meta = eval { CPAN::Meta->load_file($source) } ) ) { $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs); } else { $cpan_meta_error = $@; # capture error from CPAN::Meta->load_file($source) $source = 'static metadata'; } my @full_reports; my @dep_errors; my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs; # Add static includes into a fake section for my $mod (@include) { $req_hash->{other}{modules}{$mod} = 0; } for my $phase ( qw(configure build test runtime develop other) ) { next unless $req_hash->{$phase}; next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING}); for my $type ( qw(requires recommends suggests conflicts modules) ) { next unless $req_hash->{$phase}{$type}; my $title = ucfirst($phase).' '.ucfirst($type); my @reports = [qw/Module Want Have/]; for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) { next if grep { $_ eq $mod } @exclude; my $want = $req_hash->{$phase}{$type}{$mod}; $want = "undef" unless defined $want; $want = "any" if !$want && $want == 0; if ($mod eq 'perl') { push @reports, ['perl', $want, $]]; next; } my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required"; my $file = $mod; $file =~ s{::}{/}g; $file .= ".pm"; my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC; if ($prefix) { my $have = MM->parse_version( File::Spec->catfile($prefix, $file) ); $have = "undef" unless defined $have; push @reports, [$mod, $want, $have]; if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) { if ( $have !~ /\A$lax_version_re\z/ ) { push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)"; } elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) { push @dep_errors, "$mod version '$have' is not in required range '$want'"; } } } else { push @reports, [$mod, $want, "missing"]; if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) { push @dep_errors, "$mod is not installed ($req_string)"; } } } if ( @reports ) { push @full_reports, "=== $title ===\n\n"; my $ml = _max( map { length $_->[0] } @reports ); my $wl = _max( map { length $_->[1] } @reports ); my $hl = _max( map { length $_->[2] } @reports ); if ($type eq 'modules') { splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports; } else { splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports; } push @full_reports, "\n"; } } } if ( @full_reports ) { diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports; } if ( $cpan_meta_error || @dep_errors ) { diag "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n"; } if ( $cpan_meta_error ) { my ($orig_source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; diag "\nCPAN::Meta->load_file('$orig_source') failed with: $cpan_meta_error\n"; } if ( @dep_errors ) { diag join("\n", "\nThe following REQUIRED prerequisites were not satisfied:\n", @dep_errors, "\n" ); } pass('Reported prereqs'); # vim: ts=4 sts=4 sw=4 et: Log-Dispatchouli-3.007/t/lib/000755 000765 000024 00000000000 14474750275 016025 5ustar00rjbsstaff000000 000000 Log-Dispatchouli-3.007/t/00-report-prereqs.dd000644 000765 000024 00000005225 14474750275 021003 0ustar00rjbsstaff000000 000000 do { my $x = { 'configure' => { 'requires' => { 'ExtUtils::MakeMaker' => '6.78' } }, 'develop' => { 'requires' => { 'Encode' => '0', 'Test::More' => '0', 'Test::Pod' => '1.41' } }, 'runtime' => { 'requires' => { 'Carp' => '0', 'File::Spec' => '0', 'Log::Dispatch' => '0', 'Log::Dispatch::Array' => '0', 'Log::Dispatch::File' => '0', 'Log::Dispatch::Screen' => '0', 'Log::Dispatch::Syslog' => '0', 'Params::Util' => '0', 'Scalar::Util' => '0', 'String::Flogger' => '0', 'Sub::Exporter' => '0', 'Sub::Exporter::GlobExporter' => '0.002', 'Sys::Syslog' => '0.16', 'Try::Tiny' => '0.04', 'experimental' => '0', 'overload' => '0', 'perl' => 'v5.20.0', 'strict' => '0', 'warnings' => '0' } }, 'test' => { 'recommends' => { 'CPAN::Meta' => '2.120900' }, 'requires' => { 'ExtUtils::MakeMaker' => '0', 'File::Spec' => '0', 'File::Spec::Functions' => '0', 'File::Temp' => '0', 'JSON::MaybeXS' => '0', 'Test::Deep' => '0', 'Test::Fatal' => '0', 'Test::More' => '0.96', 'base' => '0', 'lib' => '0', 'utf8' => '0' } } }; $x; }Log-Dispatchouli-3.007/t/lib/SDR/000755 000765 000024 00000000000 14474750275 016455 5ustar00rjbsstaff000000 000000 Log-Dispatchouli-3.007/t/lib/DDR/000755 000765 000024 00000000000 14474750275 016436 5ustar00rjbsstaff000000 000000 Log-Dispatchouli-3.007/t/lib/DDR/Parent.pm000644 000765 000024 00000000351 14474750275 020224 0ustar00rjbsstaff000000 000000 use strict; package DDR::Parent; use base 'Log::Dispatchouli::Global'; sub logger_globref { no warnings 'once'; \*Logger } sub default_logger_args { return { ident => __PACKAGE__, log_pid => 0, to_self => 1, } } 1; Log-Dispatchouli-3.007/t/lib/DDR/Child.pm000644 000765 000024 00000000246 14474750275 020021 0ustar00rjbsstaff000000 000000 use strict; package DDR::Child; use base 'DDR::Parent'; sub default_logger_args { return { ident => __PACKAGE__, log_pid => 0, to_self => 1, } } 1; Log-Dispatchouli-3.007/t/lib/SDR/Parent.pm000644 000765 000024 00000000452 14474750275 020245 0ustar00rjbsstaff000000 000000 use strict; package SDR::Parent; use base 'Log::Dispatchouli::Global'; sub logger_globref { no warnings 'once'; \*Logger } my $default_logger; sub default_logger_ref { \$default_logger } sub default_logger_args { return { ident => __PACKAGE__, log_pid => 0, to_self => 1, } } 1; Log-Dispatchouli-3.007/t/lib/SDR/Child.pm000644 000765 000024 00000000246 14474750275 020040 0ustar00rjbsstaff000000 000000 use strict; package SDR::Child; use base 'SDR::Parent'; sub default_logger_args { return { ident => __PACKAGE__, log_pid => 0, to_self => 1, } } 1;