diff -uNr a/logotron/MANIFEST.TXT b/logotron/MANIFEST.TXT
--- a/logotron/MANIFEST.TXT d842b46bd643a09c4561676285ec2cd921368026994849f0e771b040a090a144a2749fb3dfad53942aa7d55d3d92037b60e771bf95358a07aff7ad7cfb775afc
+++ b/logotron/MANIFEST.TXT 9b223e8847a05c7dee552a786d8290316bf1dbf3dfca3ce7bc2080ec7b357b5c031fabc47d2586097e8f1bb0100a0e6f6c44c37acf53aa3d3fe903ff074fcd67
@@ -15,3 +15,4 @@
597858 detect_disconnect asciilifeform "Adjustable detector of bot disconnection."
598372 shlex_removal asciilifeform "Reverted defective attempt at double-quoted search."
640165 hide_inactive asciilifeform "Configurable default-hide of idle chans"
+641046 search_all_chans asciilifeform "Button to search in all logged chans"
diff -uNr a/logotron/README.txt b/logotron/README.txt
--- a/logotron/README.txt 41b2d77f5049bcf7c65dba41e46dc5464b27da3f947cecba3f3bd1ed451b2d469bf550155ec6efb49e52bea0a6467f9d5eee7b5298e2396c39a64390711b6ace
+++ b/logotron/README.txt 0a75ab02402bd83bda90e41a341753044860eb7e0013943687b0b0797356e8d9e21ba4346a71123357d791ce422ecf789a29ad8ea759bc8799f88c54ca7e66d3
@@ -119,6 +119,9 @@
Still needs a variant of 'eater' that will eat these.
+###############
+Oct. 4 Update:
+###############
(1) WWW: Removed ill-conceived 'Tape' knob.
(2) Bot: Added silent-disconnection detector.
@@ -134,10 +137,17 @@
To disable forced disconnects, set disc_t to zero.
-#################
-Jul. 2020 Update:
-#################
+####################
+Jul. 2020 Update #1:
+####################
(1) Hide by default chans where no activity in days_hide day (set in config.)
(2) Added 'join as guest' link (via 'kiwi' wwwtronic IRC client)
(3) Example Apache-WSGI configs.
+
+####################
+Jul. 2020 Update #2:
+####################
+
+(1) Fix unclosed 'table' tag from earlier.
+(2) 'Search all chans' button.
diff -uNr a/logotron/reader.py b/logotron/reader.py
--- a/logotron/reader.py 8ac522f24e0add9ba37c81161edbb0ba5fe70df54c03e73fc8a6a60bac3bf993d1530088c5a3a8a7caa90db67ee6b3cdae75a15b4c6d698ed3d95aff12e54626
+++ b/logotron/reader.py 3b5645290a520a3f935b44372a1c98f60a0bc967ea3d6ad4160ef72e455c7c9636847847007334053703765fa80176a2509e3609005e4ab8d2518d27869f8002
@@ -101,22 +101,6 @@
if (DB_DEBUG): print "query res: '{0}'".format(rv)
return rv
-def exec_db(query, args=()):
- cur = get_db().cursor(cursor_factory=psycopg2.extras.RealDictCursor)
- if (DB_DEBUG): print "query: '{0}'".format(query)
- if (DB_DEBUG): print "args: '{0}'".format(args)
- if (DB_DEBUG): print "EXEC:"
- cur.execute(query, args)
-
-def getlast_db():
- cur = get_db().cursor(cursor_factory=psycopg2.extras.RealDictCursor)
- cur.execute('select lastval()')
- return cur.fetchone()['lastval']
-
-def commit_db():
- cur = get_db().cursor(cursor_factory=psycopg2.extras.RealDictCursor)
- g.db.commit()
-
##############################################################################
## All eggogs redirect to main page
@@ -212,7 +196,7 @@
if chan_tbl[chan]['show']:
s += """
{0} | """.format(chan_tbl[chan]['time'])
# wrap up:
- s += ""
+ s += ""
return s
@@ -265,7 +249,7 @@
## Format given log line for display
-def format_logline(l, highlights = [], select=[]):
+def format_logline(l, highlights = [], select=[], showchan=False):
payload = html_escape(l['payload'])
# Format ordinary links:
@@ -296,6 +280,9 @@
speaker = l['speaker']
separator = ":"
+ if showchan:
+ speaker = '(' + l['chan'] + ') ' + speaker
+
# If 'action', annotate:
if l['self']:
separator = ""
@@ -485,10 +472,26 @@
query = request.args.get('q', default = '', type = str)
# page_num = request.args.get('page', default = 0, type = int)
- # Handle rubbish chan:
- if chan not in Channels:
- return redirect(url_for('log'))
+ # channels to search in
+ chans = []
+ # whether to indicate chan per log line
+ showchan = False
+
+ if chan == 'all':
+ # search in all logged channels
+ chans = Channels
+ legend = "all logged channels"
+ showchan = True
+ else:
+ # Handle possible rubbish chan:
+ if chan not in Channels:
+ return redirect(url_for('log'))
+ else:
+ # search in selected channel only
+ chans = [chan]
+ legend = chan
+
nres = 0
searchres = []
tokens_orig = []
@@ -514,17 +517,17 @@
# Query is usable; perform the search on DB and get the finds
if from_users == []:
searchres = query_db(
- '''select * from loglines where chan=%s
- and payload ilike all(%s) order by idx desc limit %s;''',
- [chan,
+ '''select * from loglines where chan = any(%s)
+ and payload ilike all(%s) order by t desc limit %s;''',
+ [(chans,),
tokens_formed,
Max_Search_Results], one=False)
else:
searchres = query_db(
- '''select * from loglines where chan=%s
+ '''select * from loglines where chan = any(%s)
and speaker ilike any(%s)
- and payload ilike all(%s) order by idx desc limit %s;''',
- [chan,
+ and payload ilike all(%s) order by t desc limit %s;''',
+ [(chans,),
from_users,
tokens_formed,
Max_Search_Results], one=False)
@@ -533,7 +536,7 @@
# Number of entries found
nres = len(searchres)
search_head = "{0} entries found in {1} for '{2}' :".format(
- nres, chan, html_escape(query))
+ nres, legend, html_escape(query))
# No paging support just yet:
return render_template('searchres.html',
@@ -542,8 +545,8 @@
chan = chan,
search_head = search_head,
tokens = tokens_orig,
- loglines = searchres)
-
+ loglines = searchres,
+ showchan = showchan)
# Comment this out if you don't have one
@app.route('/favicon.ico')
diff -uNr a/logotron/templates/layout.html b/logotron/templates/layout.html
--- a/logotron/templates/layout.html 7260e8531eee1e629d3bd793931237b759ccd829f1d5f5a929ef3375897ee7a5d21562e870142c24d5f3bafb44f7d7b83b1952c8fdd8554a2e8f55633f10d54c
+++ b/logotron/templates/layout.html c65b0971e605cbf05445f2562f4e363bfbfac914d389d81f946fd534e79ff3ba4b00245536fbfbaa3527127a4dec005fbe1c3242182c76c47112498cef0505d6
@@ -107,13 +107,18 @@
+ {% if chan != 'all' %}
{{ gen_chanlist( chan, show_all ) | safe }}
+ {% else %}
+ {{ gen_chanlist( chan, True ) | safe }}
+ {% endif %}
|
+ {% if chan != 'all' %}
{% if not show_all %}
@@ -127,13 +132,18 @@
{% endif %}
+ {% endif %}
-
@@ -143,7 +153,7 @@
diff -uNr a/logotron/templates/log.html b/logotron/templates/log.html
--- a/logotron/templates/log.html 2a1af43ab7aa90d58c85b05d4badf528c9d6af150c470629ae5394ddc577cae27fcf42d5527659df61a73e422af5ba67ac0aa55ac4022091455e61cf92ce3af8
+++ b/logotron/templates/log.html 1b71b2bb4cdafd0561fe834175983923a32c5e91729347e894d77ac283a608f4047fa16638d2a949936f40f3a0b5659100b4d6b7da5260008970b9f99a1f9c81
@@ -14,7 +14,7 @@
{% for l in loglines %}
- {{ format_logline(l, [], sel) | safe }}
+ {{ format_logline(l, [], sel, False) | safe }}
{% endfor %}
diff -uNr a/logotron/templates/searchres.html b/logotron/templates/searchres.html
--- a/logotron/templates/searchres.html a60ca105a579ed2b256dbfc92a7ca7468d17ba875a3215217bb1bb2ea15ac04e9e56c66205b1a4387263b068c39f9d72f08e76edce2b371f4f1aebe24bbf7f03
+++ b/logotron/templates/searchres.html 2b005c8dc669cd7229e8a3cb3932d0b53b7e49fe8d1c7e6a5c33192f81e0937f21324307473a24f7670eb3ff82fb2147dab48b3b8c3e902f25937afc1dca5783
@@ -11,7 +11,7 @@
{% for l in loglines %}
-{{ format_logline(l, tokens) | safe }}
+{{ format_logline(l, tokens, [], showchan) | safe }}
{% endfor %}
{% endblock %}