{
    "content": [
        {
            "type": "text",
            "text": "# Log::Any::Adapter::Development (perldoc)\n\n## NAME\n\nLog::Any::Adapter::Development - Manual for developing new Log::Any adapters\n\n## SYNOPSIS\n\nThe adapter module:\npackage Log::Any::Adapter::YAL;\nuse strict;\nuse warnings;\nuse Log::Any::Adapter::Util ();\nuse base qw(Log::Any::Adapter::Base);\n# Optionally initialize object, e.g. for delegation\n#\nsub init {\nmy ($self) = @;\n$self->{attr} = ...;\n}\n# Create logging methods: debug, info, etc.\n#\nforeach my $method ( Log::Any::Adapter::Util::loggingmethods() ) {\nno strict 'refs';\n*$method = sub { ... };\n}\n# or, support structured logging instead\nsub structured {\nmy ($self, $level, $category, @args) = @;\n# ... process and log all @args\n}\n# Create detection methods: isdebug, isinfo, etc.\n#\nforeach my $method ( Log::Any::Adapter::Util::detectionmethods() ) {\nno strict 'refs';\n*$method = sub { ... };\n}\nand the application:\nLog::Any->setadapter('YAL');\n\n## DESCRIPTION\n\nThis document describes how to implement a new Log::Any adapter.\n\n## Sections\n\n- **NAME**\n- **VERSION**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **NAMING**\n- **BASE CLASS**\n- **LOG LEVELS**\n- **METHODS** (6 subsections)\n- **AUTHORS**\n- **COPYRIGHT AND LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Log::Any::Adapter::Development",
        "section": "",
        "mode": "perldoc",
        "summary": "Log::Any::Adapter::Development - Manual for developing new Log::Any adapters",
        "synopsis": "The adapter module:\npackage Log::Any::Adapter::YAL;\nuse strict;\nuse warnings;\nuse Log::Any::Adapter::Util ();\nuse base qw(Log::Any::Adapter::Base);\n# Optionally initialize object, e.g. for delegation\n#\nsub init {\nmy ($self) = @;\n$self->{attr} = ...;\n}\n# Create logging methods: debug, info, etc.\n#\nforeach my $method ( Log::Any::Adapter::Util::loggingmethods() ) {\nno strict 'refs';\n*$method = sub { ... };\n}\n# or, support structured logging instead\nsub structured {\nmy ($self, $level, $category, @args) = @;\n# ... process and log all @args\n}\n# Create detection methods: isdebug, isinfo, etc.\n#\nforeach my $method ( Log::Any::Adapter::Util::detectionmethods() ) {\nno strict 'refs';\n*$method = sub { ... };\n}\nand the application:\nLog::Any->setadapter('YAL');",
        "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": 41,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "NAMING",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "BASE CLASS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "LOG LEVELS",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Constructor",
                        "lines": 23
                    },
                    {
                        "name": "Logging methods",
                        "lines": 17
                    },
                    {
                        "name": "Structured logging",
                        "lines": 6
                    },
                    {
                        "name": "Aliases",
                        "lines": 3
                    },
                    {
                        "name": "Optional methods",
                        "lines": 7
                    },
                    {
                        "name": "Support methods",
                        "lines": 11
                    }
                ]
            },
            {
                "name": "AUTHORS",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "COPYRIGHT AND LICENSE",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Log::Any::Adapter::Development - Manual for developing new Log::Any adapters\n",
                "subsections": []
            },
            "VERSION": {
                "content": "version 1.710\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "The adapter module:\n\npackage Log::Any::Adapter::YAL;\nuse strict;\nuse warnings;\nuse Log::Any::Adapter::Util ();\nuse base qw(Log::Any::Adapter::Base);\n\n# Optionally initialize object, e.g. for delegation\n#\nsub init {\nmy ($self) = @;\n\n$self->{attr} = ...;\n}\n\n# Create logging methods: debug, info, etc.\n#\nforeach my $method ( Log::Any::Adapter::Util::loggingmethods() ) {\nno strict 'refs';\n*$method = sub { ... };\n}\n\n# or, support structured logging instead\nsub structured {\nmy ($self, $level, $category, @args) = @;\n# ... process and log all @args\n}\n\n\n# Create detection methods: isdebug, isinfo, etc.\n#\nforeach my $method ( Log::Any::Adapter::Util::detectionmethods() ) {\nno strict 'refs';\n*$method = sub { ... };\n}\n\nand the application:\n\nLog::Any->setadapter('YAL');\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This document describes how to implement a new Log::Any adapter.\n\nThe easiest way to start is to look at the source of existing adapters, such as\nLog::Any::Adapter::Log4perl and Log::Any::Adapter::Dispatch.\n",
                "subsections": []
            },
            "NAMING": {
                "content": "If you are going to publicly release your adapter, call it 'Log::Any::Adapter::*something*' so\nthat users can use it with\n\nLog::Any->setadapter(I<something>);\n\nIf it's an internal driver, you can call it whatever you like and use it like\n\nLog::Any->setadapter('+My::Log::Adapter');\n",
                "subsections": []
            },
            "BASE CLASS": {
                "content": "All adapters must directly or indirectly inherit from Log::Any::Adapter::Base.\n",
                "subsections": []
            },
            "LOG LEVELS": {
                "content": "Log::Any supports the following log levels:\n\nIf the logging mechanism used by your adapter supports different levels, it's your\nresponsibility to map them appropriately when you implement the logging and detection methods\ndescribed below. For example, if your mechanism only supports \"debug\", \"normal\" and \"fatal\"\nlevels, you might map the levels like this:\n",
                "subsections": []
            },
            "METHODS": {
                "content": "",
                "subsections": [
                    {
                        "name": "Constructor",
                        "content": "The constructor (\"new\") is provided by Log::Any::Adapter::Base. It will:\n\nAt this point, overriding the default constructor is not supported. Hopefully it will not be\nneeded.\n\nThe constructor is called whenever a log object is requested. e.g. If the application\ninitializes Log::Any like so:\n\nLog::Any->setadapter('Log::YAL', yalobject => $yal, depth => 3);\n\nand then a class requests a logger like so:\n\npackage Foo;\nuse Log::Any qw($log);\n\nThen $log will be populated with the return value of:\n\nLog::Any::Adapter::Yal->new(yalobject => $yal, depth => 3, category => 'Foo');\n\nThis is memoized, so if the same category should be requested again (e.g. through a separate\n\"getlogger\" call, the same object will be returned. Therefore, you should try to avoid anything\nnon-deterministic in your \"init\" function.\n"
                    },
                    {
                        "name": "Logging methods",
                        "content": "The following methods have no default implementation, and MUST be defined by your subclass,\nunless your adapter supports \"Structured logging\":\n\nThese methods must log a message at the specified level.\n\nTo help generate these methods programmatically, you can get a list of the sub names with the\nLog::Any::Adapter::Util::loggingmethods function.\n\nLog-level detection methods (required)\nThe following methods have no default implementation, and MUST be defined by your subclass:\n\nThese methods must return a boolean indicating whether the specified level is active, i.e.\nwhether the adapter is listening for messages of that level.\n\nTo help generate these methods programmatically, you can get a list of the sub names with the\nLog::Any::Adapter::Util::detectionmethods function.\n"
                    },
                    {
                        "name": "Structured logging",
                        "content": "Your adapter can choose to receive structured data instead of a string. In this case, instead of\nimplementing all the \"Logging methods\", you define a single method called \"structured\". The\nmethod receives the log level, the category, and all arguments that were passed to the logging\nfunction, so be prepared to not only handle strings, but also hashrefs, arrayrefs, coderefs,\netc.\n"
                    },
                    {
                        "name": "Aliases",
                        "content": "Aliases (e.g. \"err\" for \"error\") are handled by Log::Any::Proxy and will call the corresponding\nreal name in your adapter class. You do not need to implement them in your adapter.\n"
                    },
                    {
                        "name": "Optional methods",
                        "content": "The following methods have no default implementation but MAY be provided by your subclass:\n\ninit\nThis is called after the adapter object is created and blessed into your class. Perform any\nnecessary validation or initialization here. For example, you would use \"init\" to create a\nlogging object for delegation, or open a file or socket, etc.\n"
                    },
                    {
                        "name": "Support methods",
                        "content": "The following Log::Any::Adapter::Base method may be useful for defining adapters via delegation:\n\ndelegatemethodtoslot ($slot, $method, $adaptermethod)\nHandle the specified $method by calling $adaptermethod on the object contained in\n\"$self->{$slot}\".\n\nSee Log::Any::Adapter::Dispatch and Log::Any::Adapter::Log4perl for examples of usage.\n\nThe following Log::Any::Adapter::Util functions give you a list of methods that you need to\nimplement. You can get logging methods, detection methods or both:\n"
                    }
                ]
            },
            "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": []
            }
        }
    }
}