llms_log( mixed $message, string $handle = 'llms' )

Log arbitrary messages to a log file


Description Description


Parameters Parameters

$message

(mixed) (Required) data to log

$handle

(string) (Optional) allow creation of multiple log files by handle

Default value: 'llms'


Top ↑

Return Return

(boolean)


Top ↑

Source Source

File: includes/functions/llms.functions.log.php

function llms_log( $message, $handle = 'llms' ) {

	$r = false;

	$fh = fopen( llms_get_log_path( $handle ), 'a' );
	// open the file (creates it if it doesn't already exist)
	if ( $fh ) {

		// print array or objects with print_r
		if ( is_array( $message ) || is_object( $message ) ) {
			$message = print_r( $message, true );
		}

		$r = fwrite( $fh, date_i18n( 'm-d-Y @ H:i:s -' ) . ' ' . $message . "\n" );

		fclose( $fh );

	}

	return $r;

}

Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.





Permalink: