<?php
require_once '../vendor/autoload.php';
$dbConfig = [
'host' => 'localhost',
'name' => '{{DATABASE_NAME}}', // set your own here
'username' => '{{USERNAME}}', // set your own here
'password' => '{{PASSWORD}}', // set your own here
'options' => [
\PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES UTF8"
]
];
/*
*
* You need to execute this query to use this logger:
CREATE TABLE logs(
id INT(11) NOT NULL AUTO_INCREMENT,
message VARCHAR(255) NOT NULL,
level VARCHAR(10) NOT NULL,
date DATETIME NOT NULL,
context TEXT,
PRIMARY KEY(ID)
);
*/
$logger = new Ite\Logger\PdoMysqlLogger($dbConfig);
$logger->info("Testing database", ['key1' => 'value1']);
$logger->alert("Testing database", ['alert' => 'alerting']);
|