{
    "content": [
        {
            "type": "text",
            "text": "# Log::Any::Proxy (perldoc)\n\n## NAME\n\nLog::Any::Proxy - Log::Any generator proxy object\n\n## SYNOPSIS\n\n# prefix log messages\nuse Log::Any '$log', prefix => 'MyApp: ';\n# transform log messages\nuse Log::Any '$log', filter => \\&myfilter;\n# format with String::Flogger instead of the default\nuse String::Flogger;\nuse Log::Any '$log', formatter => sub {\nmy ($cat, $lvl, @args) = @;\nString::Flogger::flog( @args );\n};\n# create a clone with different attributes\nmy $barlog = $log->clone( prefix => 'bar: ' );\n\n## DESCRIPTION\n\nLog::Any::Proxy objects are what modules use to produce log messages. They construct messages\nand pass them along to a configured adapter.\n\n## Sections\n\n- **NAME**\n- **VERSION**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **ATTRIBUTES**\n- **USAGE** (3 subsections)\n- **TIPS**\n- **AUTHORS**\n- **COPYRIGHT AND LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Log::Any::Proxy",
        "section": "",
        "mode": "perldoc",
        "summary": "Log::Any::Proxy - Log::Any generator proxy object",
        "synopsis": "# prefix log messages\nuse Log::Any '$log', prefix => 'MyApp: ';\n# transform log messages\nuse Log::Any '$log', filter => \\&myfilter;\n# format with String::Flogger instead of the default\nuse String::Flogger;\nuse Log::Any '$log', formatter => sub {\nmy ($cat, $lvl, @args) = @;\nString::Flogger::flog( @args );\n};\n# create a clone with different attributes\nmy $barlog = $log->clone( prefix => 'bar: ' );",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 16,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "ATTRIBUTES",
                "lines": 43,
                "subsections": []
            },
            {
                "name": "USAGE",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Simple logging",
                        "lines": 15
                    },
                    {
                        "name": "Advanced logging",
                        "lines": 18
                    },
                    {
                        "name": "Logging Structured Data",
                        "lines": 4
                    }
                ]
            },
            {
                "name": "TIPS",
                "lines": 36,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "COPYRIGHT AND LICENSE",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Log::Any::Proxy - Log::Any generator proxy object\n",
                "subsections": []
            },
            "VERSION": {
                "content": "version 1.710\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "# prefix log messages\nuse Log::Any '$log', prefix => 'MyApp: ';\n\n# transform log messages\nuse Log::Any '$log', filter => \\&myfilter;\n\n# format with String::Flogger instead of the default\nuse String::Flogger;\nuse Log::Any '$log', formatter => sub {\nmy ($cat, $lvl, @args) = @;\nString::Flogger::flog( @args );\n};\n\n# create a clone with different attributes\nmy $barlog = $log->clone( prefix => 'bar: ' );\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Log::Any::Proxy objects are what modules use to produce log messages. They construct messages\nand pass them along to a configured adapter.\n",
                "subsections": []
            },
            "ATTRIBUTES": {
                "content": "adapter\nA Log::Any::Adapter object to receive any messages logged. This is generated by Log::Any and can\nnot be overridden.\n\ncategory\nThe category name of the proxy. If not provided, Log::Any will set it equal to the calling when\nthe proxy is constructed.\n\nfilter\nA code reference to transform messages before passing them to a Log::Any::Adapter. It gets three\narguments: a category, a numeric level and a string. It should return a string to be logged.\n\nsub {\nmy ($cat, $lvl, $msg) = @;\nreturn \"[$lvl] $msg\";\n}\n\nIf the return value is undef or the empty string, no message will be logged. Otherwise, the\nreturn value is passed to the logging adapter.\n\nNumeric levels range from 0 (emergency) to 8 (trace). Constant functions for these levels are\navailable from Log::Any::Adapter::Util.\n\nConfiguring a filter disables structured logging, even if the configured adapter supports it.\n\nformatter\nA code reference to format messages given to the *f methods (\"tracef\", \"debugf\", \"infof\", etc..)\n\nIt get three or more arguments: a category, a numeric level and the list of arguments passsed to\nthe *f method. It should return a string to be logged.\n\nsub {\nmy ($cat, $lvl, $format, @args) = @;\nreturn sprintf($format, @args);\n}\n\nThe default formatter does the following:\n\nprefix\nIf defined, this string will be prepended to all messages. It will not include a trailing space,\nso add that yourself if you want. This is less flexible/powerful than \"filter\", but avoids an\nextra function call.\n",
                "subsections": []
            },
            "USAGE": {
                "content": "",
                "subsections": [
                    {
                        "name": "Simple logging",
                        "content": "Your library can do simple logging using logging methods corresponding to the log levels (or\naliases):\n\nPass a string to be logged. Do not include a newline.\n\n$log->info(\"Got some new for you.\");\n\nThe log string will be transformed via the \"filter\" attribute (if any) and the \"prefix\" (if any)\nwill be prepended. Returns the transformed log string.\n\nNOTE: While you are encouraged to pass a single string to be logged, if multiple arguments are\npassed, they are concatenated with a space character into a single string before processing.\nThis ensures consistency across adapters, some of which may support multiple arguments to their\nlogging functions (and which concatenate in different ways) and some of which do not.\n"
                    },
                    {
                        "name": "Advanced logging",
                        "content": "Your library can do advanced logging using logging methods corresponding to the log levels (or\naliases), but with an \"f\" appended:\n\nWhen these methods are called, the adapter is first checked to see if it is logging at that\nlevel. If not, the method returns without logging.\n\nNext, arguments are transformed to a message string via the \"formatter\" attribute.\n\nThe default formatter first checks if the first log argument is a code reference. If so, it will\nexecuted and the result used as the formatted message. Otherwise, the formatter acts like\n\"sprintf\" with some helpful formatting.\n\nFinally, the message string is logged via the simple logging functions, which can transform or\nprefix as described above. The transformed log string is then returned.\n\nNumeric levels range from 0 (emergency) to 8 (trace). Constant functions for these levels are\navailable from Log::Any::Adapter::Util.\n"
                    },
                    {
                        "name": "Logging Structured Data",
                        "content": "If you have data in addition to the text you want to log, you can specify a hashref after your\nstring. If the configured adapter supports structured data, it will receive the hashref as-is,\notherwise it will be converted to a string using Data::Dumper and will be appended to your text.\n"
                    }
                ]
            },
            "TIPS": {
                "content": "UTF-8 in Data Structures\nIf you have high-bit characters in a data structure being passed to a log method, Log::Any will\noutput that data structure with the high-bit characters encoded as \"\\x{###}\", Perl's escape\nsequence for high-bit characters. This is because the Data::Dumper module escapes those\ncharacters.\n\nuse utf8;\nuse Log::Any qw( $log );\nmy @data = ( \"Привет мир\" ); # Hello, World!\n$log->infof(\"Got: %s\", \\@data);\n# Got: [\"\\x{41f}\\x{440}\\x{438}\\x{432}\\x{435}\\x{442} \\x{43c}\\x{438}\\x{440}\"]\n\nIf you want to instead display the actual characters in your log file or terminal, you can use\nthe Data::Dumper::AutoEncode module. To wire this up into Log::Any, you must pass a custom\n\"formatter\" sub:\n\nuse utf8;\nuse Data::Dumper::AutoEncode;\n\nsub logformatter {\nmy ( $category, $level, $format, @params ) = @;\n# Run references through Data::Dumper::AutoEncode\n@params = map { ref $ ? eDumper( $ ) : $ } @params;\nreturn sprintf $format, @params;\n}\n\nuse Log::Any '$log', formatter => \\&logformatter;\n\nThis formatter changes the output to:\n\nGot: $VAR1 = [\n'Привет мир'\n];\n\nThanks to @denis-it <https://github.com/denis-it> for this tip!\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": []
            }
        }
    }
}