PHP code example of alleyinteractive / logger

1. Go to this page and download the library: Download alleyinteractive/logger library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

alleyinteractive / logger example snippets


// Log site-wide to the ai_log post type.
ai_logger()->info( 'Log message...' );

\AI_Logger\AI_Logger::info( 'Another format for logging.' );

ai_logger_to_post( $post_id, 'meta-key' )->info( 'This will log to the <meta-key> for a specific post.' );

ai_logger_to_term( $term_id, 'meta-key' )->info( 'This will log to the <meta-key> for a specific term.' );

ai_logger_to_qm()->info( 'This will show up in Query Monitor!' );

ai_logger()->with_context( 'example-context' )->info( 'This will log to the example-context.' );

ai_logger()->with_context(
	[
		'context' => 'example-context',
		'key'     => 'value',
	]
)->info( 'This will log to the example-context with key=>value.' );

ai_logger( 'example-context' )->info( 'This will log to the example-context.' );