Add rudimentary logger

[MAILPOET-570]
This commit is contained in:
Pavel Dohnal
2018-08-27 16:58:33 +02:00
parent 9e2a4edcd0
commit 031125517e
5 changed files with 73 additions and 1 deletions

View File

@ -85,6 +85,7 @@ class Database {
$statistics_unsubscribes = Env::$db_prefix . 'statistics_unsubscribes';
$statistics_forms = Env::$db_prefix . 'statistics_forms';
$mapping_to_external_entities = Env::$db_prefix . 'mapping_to_external_entities';
$log = Env::$db_prefix . 'log';
define('MP_SETTINGS_TABLE', $settings);
define('MP_SEGMENTS_TABLE', $segments);
@ -110,6 +111,7 @@ class Database {
define('MP_STATISTICS_UNSUBSCRIBES_TABLE', $statistics_unsubscribes);
define('MP_STATISTICS_FORMS_TABLE', $statistics_forms);
define('MP_MAPPING_TO_EXTERNAL_ENTITIES_TABLE', $mapping_to_external_entities);
define('MP_LOG_TABLE', $log);
}
}
}

View File

@ -435,10 +435,12 @@ class Migrator {
function log() {
$attributes = [
'id BIGINT unsigned NOT NULL AUTO_INCREMENT,',
'name VARCHAR(255),',
'level INTEGER,',
'message LONGTEXT,',
'time TIMESTAMP DEFAULT CURRENT_TIMESTAMP',
'created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP',
'PRIMARY KEY (id),',
];
return $this->sqlify(__FUNCTION__, $attributes);
}