customization
This commit is contained in:
parent
4da7904bdd
commit
f9f962af19
|
|
@ -3,17 +3,18 @@ from odoo import api, models
|
|||
from werkzeug._internal import _log
|
||||
|
||||
class MemoryLogHandler(logging.Handler):
|
||||
def __init__(self, max_entries=1000):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.max_entries = max_entries
|
||||
# self.max_entries = max_entries
|
||||
self.entries = []
|
||||
|
||||
def emit(self, record):
|
||||
if '/log_viewer/get_logs' in getattr(record, 'message', ''):
|
||||
return
|
||||
self.entries.append(self.format(record))
|
||||
if len(self.entries) > self.max_entries:
|
||||
self.entries.pop(0)
|
||||
# if len(self.entries) > self.max_entries:
|
||||
# self.entries.pop(0)
|
||||
|
||||
|
||||
class LogHandlerManager(models.AbstractModel):
|
||||
_name = 'log.handler.manager'
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
<t t-set="title">Odoo Log Viewer</t>
|
||||
<div class="container">
|
||||
<h1>Odoo Log</h1>
|
||||
<pre id="log-content"></pre>
|
||||
<pre id="log-content" style="white-space: pre-wrap;"></pre>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var password = "<t t-esc="request.params.get('password')"/>";
|
||||
|
|
@ -59,7 +59,7 @@
|
|||
|
||||
// Update logs immediately and then every 3 seconds
|
||||
updateLogs();
|
||||
setInterval(updateLogs, 3000);
|
||||
setInterval(updateLogs, 1000);
|
||||
</script>
|
||||
</t>
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Reference in New Issue