Skip to content

Commit e5f6923

Browse files
committed
1.71, logs: specific URLs
1 parent 35566d6 commit e5f6923

File tree

2 files changed

+40
-12
lines changed

2 files changed

+40
-12
lines changed

README.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
(c) Noprianto <nop@noprianto.com>
88
2012-2019
99
License: GPL
10-
Version: 1.70
10+
Version: 1.71
1111

1212
SQLiteBoy is an independent product, developed separately from the
1313
SQLite core library, which is maintained by SQLite.org.
@@ -3312,5 +3312,9 @@ Logs
33123312
- If the logs are stored in the current database, please use table browse
33133313
(admin) or reports
33143314

3315+
- To log only specific URLs (and discard everything else), please set in
3316+
System configuration (new in v1.71). Please start each URL with / and
3317+
separate URLs with whitespace.
3318+
33153319

33163320

sqliteboy.py

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#----------------------------------------------------------------------#
3232
NAME = 'sqliteboy'
3333
APP_DESC = 'Simple web-based management tool for SQLite database (with form, report, website, and many other features)'
34-
VERSION = '1.70'
34+
VERSION = '1.71'
3535
WSITE = 'http://sqliteboy.com'
3636
TITLE = NAME + ' ' + VERSION
3737
TITLE_DEFAULT = NAME
@@ -330,6 +330,15 @@
330330
'log_init',
331331
0,
332332
),
333+
(
334+
'x_log',
335+
'x_log_override',
336+
'log.override.',
337+
'log.override..%s' %(''),
338+
'',
339+
str,
340+
1,
341+
),
333342
(
334343
'x_users',
335344
'x_user_defined_profile_ref',
@@ -1939,6 +1948,7 @@ def _render_option(self, arg, indent=' '):
19391948
'x_not_avail_pdf': 'not available, PDF output will be disabled',
19401949
'x_log': 'logs',
19411950
'x_log_access': 'access log path (absolute, forward slash / for separator, will be verified on save or empty string if verification failed, use current database might impact the database)',
1951+
'x_log_override': 'log only specific URLs (please start each URL with /, separate URLs with whitespace, will discard everything else)',
19421952
'x_link': 'links',
19431953
'x_link_login': 'additional/custom links at login page (please read Link Code Reference)',
19441954
'x_url': 'url',
@@ -3436,16 +3446,30 @@ def proc_log(handle):
34363446
#
34373447
env = web.ctx.env
34383448
#
3439-
dbtest.insert(
3440-
LOG_TABLE,
3441-
a=env.get('REMOTE_ADDR', ''),
3442-
b=env.get('HTTP_X_FORWARDED_FOR', ''),
3443-
c=env.get('HTTP_USER_AGENT', ''),
3444-
d=user(),
3445-
e=web.ctx.method,
3446-
f=web.ctx.path,
3447-
g=web.ctx.query,
3448-
)
3449+
save = True
3450+
path = web.ctx.path
3451+
#
3452+
override = s_select('log.override..')
3453+
if override:
3454+
override = override[0]['d'].split()
3455+
if override:
3456+
override = [x.strip() for x in override if x.strip()]
3457+
if override:
3458+
save = False
3459+
if path in override:
3460+
save = True
3461+
#
3462+
if save:
3463+
dbtest.insert(
3464+
LOG_TABLE,
3465+
a=env.get('REMOTE_ADDR', ''),
3466+
b=env.get('HTTP_X_FORWARDED_FOR', ''),
3467+
c=env.get('HTTP_USER_AGENT', ''),
3468+
d=user(),
3469+
e=web.ctx.method,
3470+
f=path,
3471+
g=web.ctx.query,
3472+
)
34493473
except:
34503474
pass
34513475
#

0 commit comments

Comments
 (0)