This commit is contained in:
Jean-Yves Gaulier
2015-12-23 15:56:54 +01:00
parent 78be8977de
commit 8a012973bc
4 changed files with 29 additions and 6 deletions

View File

@@ -178,6 +178,7 @@ class TaskManagerController extends Controller
public function getSchedulerLog(Request $request)
{
file_put_contents("/tmp/phraseanet-log.txt", sprintf("%s (%d) %s\n", __FILE__, __LINE__, var_export(null, true)), FILE_APPEND);
/** @var LogFileFactory $factory */
$factory = $this->app['task-manager.log-file.factory'];
$logFile = $factory->forManager();
@@ -185,7 +186,7 @@ class TaskManagerController extends Controller
$logFile->clear($request->query->get('version'));
}
return $this->render('admin/task-manager/log.html.twig', [
return $this->render('admin/task-manager/log_scheduler.html.twig', [
'logfile' => $logFile,
'version' => $request->query->get('version'),
'logname' => 'Scheduler',
@@ -202,7 +203,7 @@ class TaskManagerController extends Controller
$logFile->clear($request->query->get('version'));
}
return $this->render('admin/task-manager/log.html.twig', [
return $this->render('admin/task-manager/log_task.html.twig', [
'logfile' => $logFile,
'version' => $request->query->get('version'),
'logname' => sprintf('%s (task id %d)', $task->getName(), $task->getId()),

View File

@@ -47,6 +47,8 @@ class TaskLogFile extends AbstractLogFile implements LogFileInterface
*/
public function getPath($version)
{
$path = sprintf('%s/task_%d%s.log', $this->root, $this->task->getId(), $version ? ('-'.$version) : '');
file_put_contents("/tmp/phraseanet-log.txt", sprintf("%s (%d) %s\n", __FILE__, __LINE__, var_export($path, true)), FILE_APPEND);
return sprintf('%s/task_%d%s.log', $this->root, $this->task->getId(), $version ? ('-'.$version) : '');
}
}

View File

@@ -3,11 +3,7 @@
</a>
<h4>{{ logname }}</h4>
{% for v in logfile.getVersions() %}
{% if version != null and v == version %}
<b>{{v}}]</b>
{% else %}
<a href="{{ path('admin_tasks_scheduler_log', { 'version' : v }) }}">[{{v}}]</a>
{% endif %}
&nbsp;
{% endfor %}
{% if version != null %}

View File

@@ -0,0 +1,24 @@
<a href="{{ path('admin_tasks_list') }} ">
< {{ 'Return' | trans }}
</a>
<h4>
{{ logfile.getTask().getName() }} (task id {{ logfile.getTask.getId() }})
{% if version is not null %}
version {{ version ? version : "(now)" }}
{% endif %}
</h4>
{% for v in logfile.getVersions() %}
<a href="{{ path('admin_tasks_task_log', {'task':logfile.getTask.getId(), 'version' : v }) }}">{{ v ? v : "(now)" }}</a>
&nbsp;
{% endfor %}
{% if version is not null %}
<pre>
{{ logfile.getContent(version) }}
</pre>
<a href="{{ path('admin_tasks_task_log', {'task':logfile.getTask.getId(), 'clr' : logfile.getPath(version) }) }} ">
{{ 'Clear' | trans }}
</a>
{% endif %}