From 93590fb27253b99f21b01a0d2056389b96eb2a3f Mon Sep 17 00:00:00 2001 From: Sam Georges Date: Wed, 30 Jul 2014 17:18:59 +1000 Subject: [PATCH] TraceLog -> EventLog Cms\ErrorLog -> System\RequestLog Set up some basic language keys --- modules/backend/controllers/AccessLogs.php | 41 +++++++++++++++++ .../controllers/accesslogs/_list_toolbar.htm | 3 ++ .../controllers/accesslogs/config_list.yaml | 15 +++++++ .../backend/controllers/accesslogs/index.htm | 1 + modules/backend/lang/en/lang.php | 4 ++ modules/system/controllers/EventLogs.php | 44 +++++++++++++++++++ modules/system/controllers/RequestLogs.php | 44 +++++++++++++++++++ .../controllers/eventlogs/_list_toolbar.htm | 7 +++ .../controllers/eventlogs/config_form.yaml | 19 ++++++++ .../controllers/eventlogs/config_list.yaml | 15 +++++++ .../system/controllers/eventlogs/index.htm | 1 + .../system/controllers/eventlogs/preview.htm | 19 ++++++++ .../controllers/requestlogs/_list_toolbar.htm | 7 +++ .../controllers/requestlogs/config_form.yaml | 19 ++++++++ .../controllers/requestlogs/config_list.yaml | 15 +++++++ .../system/controllers/requestlogs/index.htm | 1 + .../controllers/requestlogs/preview.htm | 19 ++++++++ ...014_10_01_000011_Db_System_Event_Logs.php} | 6 +-- ...4_10_01_000012_Db_System_Request_Logs.php} | 7 +-- modules/system/lang/en/lang.php | 10 +++++ .../models/{TraceLog.php => EventLog.php} | 4 +- .../models/RequestLog.php} | 6 +-- .../{tracelog => eventlog}/columns.yaml | 0 .../models/requestlog}/columns.yaml | 0 24 files changed, 296 insertions(+), 11 deletions(-) create mode 100644 modules/backend/controllers/AccessLogs.php create mode 100644 modules/backend/controllers/accesslogs/_list_toolbar.htm create mode 100644 modules/backend/controllers/accesslogs/config_list.yaml create mode 100644 modules/backend/controllers/accesslogs/index.htm create mode 100644 modules/system/controllers/EventLogs.php create mode 100644 modules/system/controllers/RequestLogs.php create mode 100644 modules/system/controllers/eventlogs/_list_toolbar.htm create mode 100644 modules/system/controllers/eventlogs/config_form.yaml create mode 100644 modules/system/controllers/eventlogs/config_list.yaml create mode 100644 modules/system/controllers/eventlogs/index.htm create mode 100644 modules/system/controllers/eventlogs/preview.htm create mode 100644 modules/system/controllers/requestlogs/_list_toolbar.htm create mode 100644 modules/system/controllers/requestlogs/config_form.yaml create mode 100644 modules/system/controllers/requestlogs/config_list.yaml create mode 100644 modules/system/controllers/requestlogs/index.htm create mode 100644 modules/system/controllers/requestlogs/preview.htm rename modules/system/database/migrations/{2014_10_01_000011_Db_System_Trace_Log.php => 2014_10_01_000011_Db_System_Event_Logs.php} (74%) rename modules/{cms/database/migrations/2014_10_01_000001_Db_Cms_Error_Log.php => system/database/migrations/2014_10_01_000012_Db_System_Request_Logs.php} (67%) rename modules/system/models/{TraceLog.php => EventLog.php} (90%) rename modules/{cms/models/ErrorLog.php => system/models/RequestLog.php} (86%) rename modules/system/models/{tracelog => eventlog}/columns.yaml (100%) rename modules/{cms/models/errorlog => system/models/requestlog}/columns.yaml (100%) diff --git a/modules/backend/controllers/AccessLogs.php b/modules/backend/controllers/AccessLogs.php new file mode 100644 index 000000000..19961285b --- /dev/null +++ b/modules/backend/controllers/AccessLogs.php @@ -0,0 +1,41 @@ + + + \ No newline at end of file diff --git a/modules/backend/controllers/accesslogs/config_list.yaml b/modules/backend/controllers/accesslogs/config_list.yaml new file mode 100644 index 000000000..bc255e553 --- /dev/null +++ b/modules/backend/controllers/accesslogs/config_list.yaml @@ -0,0 +1,15 @@ +# =================================== +# List Behavior Config +# =================================== + +title: Access Log +list: @/modules/backend/models/accesslog/columns.yaml +modelClass: Backend\Models\AccessLog +recordUrl: backend/accesslogs/preview/:id +noRecordsMessage: backend::lang.list.no_records +showSetup: false + +toolbar: + buttons: list_toolbar + search: + prompt: backend::lang.list.search_prompt \ No newline at end of file diff --git a/modules/backend/controllers/accesslogs/index.htm b/modules/backend/controllers/accesslogs/index.htm new file mode 100644 index 000000000..498d5dc56 --- /dev/null +++ b/modules/backend/controllers/accesslogs/index.htm @@ -0,0 +1 @@ +listRender() ?> \ No newline at end of file diff --git a/modules/backend/lang/en/lang.php b/modules/backend/lang/en/lang.php index 13ec1161b..7d14d1a1b 100644 --- a/modules/backend/lang/en/lang.php +++ b/modules/backend/lang/en/lang.php @@ -187,4 +187,8 @@ return [ 'locale' => 'Language', 'locale_comment' => 'Select your desired locale for language use.', ], + 'access_log' => [ + 'menu_label' => 'Access Log', + 'menu_description' => 'View a list of successful back-end user sign ins.', + ], ]; diff --git a/modules/system/controllers/EventLogs.php b/modules/system/controllers/EventLogs.php new file mode 100644 index 000000000..4b2c5538f --- /dev/null +++ b/modules/system/controllers/EventLogs.php @@ -0,0 +1,44 @@ + + + + + \ No newline at end of file diff --git a/modules/system/controllers/eventlogs/config_form.yaml b/modules/system/controllers/eventlogs/config_form.yaml new file mode 100644 index 000000000..466e9b063 --- /dev/null +++ b/modules/system/controllers/eventlogs/config_form.yaml @@ -0,0 +1,19 @@ +# =================================== +# Form Behavior Config +# =================================== + +# Record name +name: Log + +# Model Form Field configuration +form: @/modules/system/models/eventlog/fields.yaml + +# Model Class name +modelClass: System\Models\EventLog + +# Default redirect location +defaultRedirect: system/eventlogs + +# Preview page +preview: + title: Event \ No newline at end of file diff --git a/modules/system/controllers/eventlogs/config_list.yaml b/modules/system/controllers/eventlogs/config_list.yaml new file mode 100644 index 000000000..ffea25682 --- /dev/null +++ b/modules/system/controllers/eventlogs/config_list.yaml @@ -0,0 +1,15 @@ +# =================================== +# List Behavior Config +# =================================== + +title: Event Log +list: @/modules/system/models/eventlog/columns.yaml +modelClass: System\Models\EventLog +recordUrl: system/eventlogs/preview/:id +noRecordsMessage: backend::lang.list.no_records +showSetup: false + +toolbar: + buttons: list_toolbar + search: + prompt: backend::lang.list.search_prompt \ No newline at end of file diff --git a/modules/system/controllers/eventlogs/index.htm b/modules/system/controllers/eventlogs/index.htm new file mode 100644 index 000000000..498d5dc56 --- /dev/null +++ b/modules/system/controllers/eventlogs/index.htm @@ -0,0 +1 @@ +listRender() ?> \ No newline at end of file diff --git a/modules/system/controllers/eventlogs/preview.htm b/modules/system/controllers/eventlogs/preview.htm new file mode 100644 index 000000000..ff306fc70 --- /dev/null +++ b/modules/system/controllers/eventlogs/preview.htm @@ -0,0 +1,19 @@ + + + + +fatalError): ?> + +
+ formRenderPreview() ?> +
+ + + +

fatalError) ?>

+

Return to event log list

+ + \ No newline at end of file diff --git a/modules/system/controllers/requestlogs/_list_toolbar.htm b/modules/system/controllers/requestlogs/_list_toolbar.htm new file mode 100644 index 000000000..f5f0b0dc0 --- /dev/null +++ b/modules/system/controllers/requestlogs/_list_toolbar.htm @@ -0,0 +1,7 @@ +
+ + + +
\ No newline at end of file diff --git a/modules/system/controllers/requestlogs/config_form.yaml b/modules/system/controllers/requestlogs/config_form.yaml new file mode 100644 index 000000000..df72d7376 --- /dev/null +++ b/modules/system/controllers/requestlogs/config_form.yaml @@ -0,0 +1,19 @@ +# =================================== +# Form Behavior Config +# =================================== + +# Record name +name: Log + +# Model Form Field configuration +form: @/modules/system/models/requestlog/fields.yaml + +# Model Class name +modelClass: System\Models\RequestLog + +# Default redirect location +defaultRedirect: system/requestlogs + +# Preview page +preview: + title: Request \ No newline at end of file diff --git a/modules/system/controllers/requestlogs/config_list.yaml b/modules/system/controllers/requestlogs/config_list.yaml new file mode 100644 index 000000000..56fedb26b --- /dev/null +++ b/modules/system/controllers/requestlogs/config_list.yaml @@ -0,0 +1,15 @@ +# =================================== +# List Behavior Config +# =================================== + +title: Request Log +list: @/modules/system/models/requestlog/columns.yaml +modelClass: System\Models\RequestLog +recordUrl: system/requestlogs/preview/:id +noRecordsMessage: backend::lang.list.no_records +showSetup: false + +toolbar: + buttons: list_toolbar + search: + prompt: backend::lang.list.search_prompt \ No newline at end of file diff --git a/modules/system/controllers/requestlogs/index.htm b/modules/system/controllers/requestlogs/index.htm new file mode 100644 index 000000000..498d5dc56 --- /dev/null +++ b/modules/system/controllers/requestlogs/index.htm @@ -0,0 +1 @@ +listRender() ?> \ No newline at end of file diff --git a/modules/system/controllers/requestlogs/preview.htm b/modules/system/controllers/requestlogs/preview.htm new file mode 100644 index 000000000..e72051efb --- /dev/null +++ b/modules/system/controllers/requestlogs/preview.htm @@ -0,0 +1,19 @@ + + + + +fatalError): ?> + +
+ formRenderPreview() ?> +
+ + + +

fatalError) ?>

+

Return to request log list

+ + \ No newline at end of file diff --git a/modules/system/database/migrations/2014_10_01_000011_Db_System_Trace_Log.php b/modules/system/database/migrations/2014_10_01_000011_Db_System_Event_Logs.php similarity index 74% rename from modules/system/database/migrations/2014_10_01_000011_Db_System_Trace_Log.php rename to modules/system/database/migrations/2014_10_01_000011_Db_System_Event_Logs.php index 1996f90b6..abebefa58 100644 --- a/modules/system/database/migrations/2014_10_01_000011_Db_System_Trace_Log.php +++ b/modules/system/database/migrations/2014_10_01_000011_Db_System_Event_Logs.php @@ -3,12 +3,12 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; -class DbSystemTraceLog extends Migration +class DbSystemEventLogs extends Migration { public function up() { - Schema::create('system_trace_log', function(Blueprint $table) + Schema::create('system_event_logs', function(Blueprint $table) { $table->engine = 'InnoDB'; $table->increments('id'); @@ -21,7 +21,7 @@ class DbSystemTraceLog extends Migration public function down() { - Schema::dropIfExists('system_trace_log'); + Schema::dropIfExists('system_event_logs'); } } diff --git a/modules/cms/database/migrations/2014_10_01_000001_Db_Cms_Error_Log.php b/modules/system/database/migrations/2014_10_01_000012_Db_System_Request_Logs.php similarity index 67% rename from modules/cms/database/migrations/2014_10_01_000001_Db_Cms_Error_Log.php rename to modules/system/database/migrations/2014_10_01_000012_Db_System_Request_Logs.php index 171a0b8ae..0e4c33fd2 100644 --- a/modules/cms/database/migrations/2014_10_01_000001_Db_Cms_Error_Log.php +++ b/modules/system/database/migrations/2014_10_01_000012_Db_System_Request_Logs.php @@ -3,16 +3,17 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; -class DbCmsErrorLog extends Migration +class DbSystemRequestLogs extends Migration { public function up() { - Schema::create('cms_error_log', function(Blueprint $table) + Schema::create('system_request_logs', function(Blueprint $table) { $table->engine = 'InnoDB'; $table->increments('id'); $table->string('url')->nullable(); + $table->integer('status_code')->nullable(); $table->string('referer')->nullable(); $table->integer('count')->default(0); $table->timestamps(); @@ -21,7 +22,7 @@ class DbCmsErrorLog extends Migration public function down() { - Schema::dropIfExists('cms_error_log'); + Schema::dropIfExists('system_request_logs'); } } diff --git a/modules/system/lang/en/lang.php b/modules/system/lang/en/lang.php index e506ee274..a16bb28a1 100644 --- a/modules/system/lang/en/lang.php +++ b/modules/system/lang/en/lang.php @@ -176,4 +176,14 @@ return [ 'zip' => [ 'extract_failed' => "Unable to extract core file ':file'.", ], + 'event_log' => [ + 'menu_label' => 'Event Log', + 'menu_description' => 'View system log messages with their recorded time and details.', + 'empty' => 'Empty event log', + ], + 'request_log' => [ + 'menu_label' => 'Request Log', + 'menu_description' => 'View bad or redirected requests, such as Page not found (404).', + 'empty' => 'Empty request log', + ], ]; diff --git a/modules/system/models/TraceLog.php b/modules/system/models/EventLog.php similarity index 90% rename from modules/system/models/TraceLog.php rename to modules/system/models/EventLog.php index 9fa862bbc..0b91c3714 100644 --- a/modules/system/models/TraceLog.php +++ b/modules/system/models/EventLog.php @@ -5,13 +5,13 @@ use Model; /** * Model for logging system errors and debug trace messages */ -class TraceLog extends Model +class EventLog extends Model { /** * @var string The database table used by the model. */ - protected $table = 'system_trace_log'; + protected $table = 'system_event_logs'; /** * Creates a log record diff --git a/modules/cms/models/ErrorLog.php b/modules/system/models/RequestLog.php similarity index 86% rename from modules/cms/models/ErrorLog.php rename to modules/system/models/RequestLog.php index 7b9560dfe..679e00829 100644 --- a/modules/cms/models/ErrorLog.php +++ b/modules/system/models/RequestLog.php @@ -1,4 +1,4 @@ -