1. Go to this page and download the library: Download sohelaman/hello-log 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/ */
sohelaman / hello-log example snippets
// Composer autoload
og;
// Create a HelloLog instance
$hellolog = new HelloLog('/home/sohel/Documents/Logfile.log');
// Simply print a message, this will not put message in log file
$hellolog->msg('Arthur Curry, I hear you can talk to fish.');
// Put some info in log file
$data = "Luke, I am your father!";
$hellolog->info($data);
// AND YESS!! There are shortcuts too!
$data = array("Diana" => "He said he'll fight with us?", "Bruce" => "More or less.");
$hellolog->i($data); // Same as info()
// Similarly put error or warning into the log
$hellolog->warn("So, you're fast?");
$hellolog->error("That feels like an over simplification.");
// Pass array or object
$hellolog->i($_SERVER);
// Return output instead of putting into log. Pass true as second parameter.
echo $hellolog->i("I'm real when it's useful.", true); // Prints instead of putting into log
$hellolog = new HelloLog();
$hellolog = new HelloLog(<file path>, <file segmentation>);
$hellolog = new HelloLog('/home/sohel/Documents/Logfile.log', 'DAY');
$hellolog = new HelloLog(<file path>, <file segmentation>, <overwrite flag>);
$hellolog = new HelloLog('/home/sohel/Documents/Logfile.log', 'DAY', true);
$hellolog->overwrite(false); // Turns off overwrite flag. So, logs will be appended after this call.
$hellolog->overwrite(true); // Turns on overwrite flag.
echo $hellolog->count(); // Increments the counter by one
echo $hellolog->count('DEC'); // Decrements the counter by one
echo $hellolog->count('RESET'); // Resets the counter to zero
echo $hellolog->count('GET'); // Get the current counter value
$hellolog->time();
echo $hellolog->time(true);
$hellolog->msg('Winter is coming!');
$hellolog->msg(); // This will simply print 'Hello, World!'
<pre>
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.