{
    "mode": "perldoc",
    "parameter": "Log::Any::Adapter::Capture",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Log%3A%3AAny%3A%3AAdapter%3A%3ACapture/json",
    "generated": "2026-07-05T09:31:59Z",
    "synopsis": "# temporarily redirect arrays of [ $level, $category, $message ] into an array\nLog::Any::Adapter->set( { lexically => \\my $scope }, Capture => to => \\my @array );\n# temporarily redirect just the text of log messages into an array\nLog::Any::Adapter->set( { lexically => \\my $scope }, Capture => text => \\my @array );\n# temporarily redirect the full argument list and context of each call, but only for\n# log levels 'info' and above.\nLog::Any::Adapter->set(\n{ lexically => \\my $scope },\nCapture =>\nformat => 'structured',\nto => \\my @array,\nloglevel => 'info'\n);",
    "sections": {
        "NAME": {
            "content": "Log::Any::Adapter::Capture - Adapter for capturing log messages into an arrayref\n",
            "subsections": []
        },
        "VERSION": {
            "content": "version 1.710\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "# temporarily redirect arrays of [ $level, $category, $message ] into an array\nLog::Any::Adapter->set( { lexically => \\my $scope }, Capture => to => \\my @array );\n\n# temporarily redirect just the text of log messages into an array\nLog::Any::Adapter->set( { lexically => \\my $scope }, Capture => text => \\my @array );\n\n# temporarily redirect the full argument list and context of each call, but only for\n# log levels 'info' and above.\nLog::Any::Adapter->set(\n{ lexically => \\my $scope },\nCapture =>\nformat => 'structured',\nto => \\my @array,\nloglevel => 'info'\n);\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This logging adapter provides a convenient way to capture log messages into a callback or\narrayref of your choice without needing to write your own adapter. It is intended for cases\nwhere you want to temporarily capture log messages, such as showing them to a user of your\napplication rather than having them written to a log file.\n",
            "subsections": []
        },
        "ATTRIBUTES": {
            "content": "to\nSpecify a coderef or arrayref where the messages will be delivered. The content pushed onto the\narray or passed to the coderef depends on \"format\".\n\nformat\n'messages'\nsub ( $level, $category, $messagetext ) { ... }\npush @to, [ $level, $category, $messagetext ];\n\nThis is the default format. It passes/pushes 3 arguments: the name of the log level, the\nlogging category, and the message text as a plain string.\n\n'text'\nsub ( $messagetext ) { ... }\npush @to, $messagetext;\n\nThis format is the simplest, and only passes/pushes the text of the message.\n\n'structured'\nsub ( $level, $category, @messageparts, \\%context? ) { ... }\npush @to, [ $level, $category, @messageparts, \\%context? ];\n\nThis passes/pushes the full information available about the call to the logging method. The\n@messageparts are the actual arguments passed to the logging method, and if the final\nargument is a hashref, it is the combined \"context\" from the logging proxy and any overrides\npassed to the logging method.\n\nloglevel\nLike other logging adapters, this optional argument can filter out any log messages above the\nspecified threshhold. The default is to pass through all messages regardless of level.\n",
            "subsections": []
        },
        "ATTRIBUTE ALIASES": {
            "content": "These are not actual attributes, just shortcuts for others:\n\ntext\ntext => $dest\n\nis shorthand for\n\nformat => 'text', to => $dest\n\nstructured\nstructured => $dest\n\nis shorthand for\n\nformat => 'structured', to => $dest\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "*   Jonathan Swartz <swartz@pobox.com>\n\n*   David Golden <dagolden@cpan.org>\n\n*   Doug Bell <preaction@cpan.org>\n\n*   Daniel Pittman <daniel@rimspace.net>\n\n*   Stephen Thirlwall <sdt@cpan.org>\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENSE": {
            "content": "This software is copyright (c) 2017 by Jonathan Swartz, David Golden, and Doug Bell.\n\nThis is free software; you can redistribute it and/or modify it under the same terms as the Perl\n5 programming language system itself.\n",
            "subsections": []
        }
    },
    "summary": "Log::Any::Adapter::Capture - Adapter for capturing log messages into an arrayref",
    "flags": [],
    "examples": [],
    "see_also": []
}