patch to make logs more readable and usable

patch to make logs more readable and usable

- Ne Nashev の投稿
返信数: 20
In logs table (/course/user.php?mode=alllogs...) too hard to see when user was started working, when hi was done, how long hi was working and how long they was away.

I have idea: if interval between two log records more then one hour, we can write session separator! It can be with some information about displayed working session and about founded interval.

And this idea in result here as simple patch (in base of v1.5.3+), which i would like to be injected into main moodle branch. General developers, please, look at this and add into CSV!


to file /course/lib.php add two piece of code

1) Inside loop by log records add
        $log->url  = str_replace('&', '&', $log->url); /// XHTML compatibility

// <<-- start of addition 1
if (isset($PrevTime) and (($PrevTime - $log->time) > 1*60*60)) {
echo '<tr class="r'.$row.'"><td colspan=6>';
echo get_string('log_work_time').': ';
$diff = (floor($BeginTime / 60) - floor($PrevTime / 60)) * 60;
echo $diff==0?'0':format_time($diff);
unset($BeginTime);
echo '<hr>'.get_string('log_interval').': ';
echo format_time((floor($PrevTime / 60) - floor($log->time / 60)) * 60);
echo '<br><hr></td></tr>';
}
$PrevTime = $log->time;
if (!isset($BeginTime)) {
$BeginTime = $log->time;
}
// -->> finish of addition 1
2) just after cicle:
    }
// <<-- start of addition 2
if (isset($PrevTime) and isset($BeginTime)) {
echo '<tr class="r'.$row.'"><td colspan=6>';
echo get_string('log_work_time').': ';
$diff = (floor($BeginTime / 60) - floor($PrevTime / 60)) * 60;
echo $diff==0?'0':format_time($diff);
echo '</td></tr>';
}
// -->> finish of addition 2
echo '</table>';
And (optional Улыбка) into lang/en/moodle.php add two strings - 'log_work_time' and 'log_interval' with some interpretation.
Ne Nashev への返信

Re: patch to make logs more readable and usable

- Jeremy B の投稿
Hello,

This is an excellent patch.  I've tested it on my systems and it works perfectly.  My clients find this additional information in the logs very useful.

Thanks again for putting your time into this.

JB
Ne Nashev への返信

Re: patch to make logs more readable and usable

- Julian Ridden の投稿
Very nice addition. I have included a screencap for those who want to see exactly what this does.
添付 Picture_2.png
Julian Ridden への返信

Urgent !!! Re: patch to make logs more readable and usable

- Hajjej Mohamed Ala Eddine の投稿

Hello,
I try to add these codes in the page / course / lib.php but the patch does not work is that you can tell me exactly where to add the code
Please find the original file lib.php  and the file  lib.php after modification is that I have insert the code
Thank you in advance

Ne Nashev への返信

Re: patch to make logs more readable and usable

- Martin Dougiamas の投稿
画像 Core developers 画像 Documentation writers 画像 Moodle HQ 画像 Particularly helpful Moodlers 画像 Plugin developers 画像 Testers
Good idea, though shouldn't this only be applied to one-person logs?

If you had 20 people using Moodle at the same time does it make sense to call it a session?  複雑な
Martin Dougiamas への返信

in multi-person logs it look fine too

- Ne Nashev の投稿
i'd try to find multi-user logs to see this there - and found
/course/log.php?id=1&chooselog=1&user=0&date=0&modid=&modaction=&group=-1&perpage=100&page=3

As result can say: in my site it looks as nice moodle-wide activity sessions information 笑顔
Ne Nashev への返信

Re: in multi-person logs it look fine too

- Martin Dougiamas の投稿
画像 Core developers 画像 Documentation writers 画像 Moodle HQ 画像 Particularly helpful Moodlers 画像 Plugin developers 画像 Testers
Can you show a screenshot?  One with many people accessing Moodle at the same time.  I don't think sessions makes sense in that case.
Martin Dougiamas への返信

Re: in multi-person logs it look fine too

- Ne Nashev の投稿
In sites with single time zone users it will be day from day separations - in logs it useful.

In multi time zone sites it will be only display holes in user activity - it useful for site admin to make in this times some site-wide manipulations.

Main here - to position this feature as is - as displaying log holes more then one hour, but not as "user work sessions".

I am in my russian interface translate work time as "Итого" (it is like footer "Summ" in last line of financial tables) and interval as "Перерыв в работе:" (it like "Break in works") - sorry my English

P.S.: in my site now much less then 20 active users, but here screenshot for you:
添付 full_logs.jpg
Ne Nashev への返信

Re: patch to make logs more readable and usable

- Bernard Boucher の投稿
Hi Ne,
very good addition.

I use a small "stats line" before details:

.

For 1 user ( Admin ) at that semester, 1146 differents activities, 12485 events, 357 hours total, 290 hours in school ( Cegep ) , 66 hours outside.

Another example for 1 user all activities for one 45 hours course:

.

1 activity and 1 group it give at least then number of users that did the activity:

.

It is sure that the totals for many users are less meaningfull that the totals of one user.

Maybe it should be good to integrate the two hacks?

I hope it may help,

Bernard





Ne Nashev への返信

Re: patch to make logs more readable and usable

- N Hansen の投稿
I'd like something that would allow me to track users by their IP. Sometimes people start off as guests but then register at some point later, but that can only be tracked through the IP. Some people may regularly visit the site as a guest unless they want to post something, and again, that could be tracked by IP. It won't work for all users, especially ones on AOL, but it would in some cases be a better alternative for tracking behavior.
N Hansen への返信

Re: patch to make logs more readable and usable - IP tracking

- David Delgado の投稿

And... what about dynamic IP systems? I think they are most common nowadays. Each time you connect, you are assigned a different IP (not in my case ウインク).

You can also go directly to the Apache logs and track IP's by copying the log file and filtering it with grep utility (show only that IP hits). Anyway, it is quite an advanced feature to implement in Moodle web interface, isn't it?

David Delgado への返信

Re: patch to make logs more readable and usable - IP tracking

- Ne Nashev の投稿
it may be interesting, if with "no user" and "Guest user" become displaying (in grey or by popup hint) list of users, which anywhen was logged from same IP!
Ne Nashev への返信

Re: patch to make logs more readable and usable - IP tracking

- Mark Little の投稿
Hi,

On what line do u add this coding?

Thanks
Mark Little への返信

Re: patch to make logs more readable and usable - IP tracking

- Ne Nashev の投稿
this - it is You about path to make more readable? in this case first block just after after line " $log->url = str_replace('&', '&', $log->url); /// XHTML compatibility" and second - before line with printing </table> that just after loop.

if you about IP tracking - i hav'nt code for that feature, but i think it is simple to make it and locate place for them
Ne Nashev への返信

Re: patch to make logs more readable and usable

- Tatiana Reis の投稿
Good morning to all of Brazil and I am not a PHP programmer, despite having seen several prints of paintings and wonderful reports could not do this, personal staff a little patience but we are many lay people, need the things explained well, I put the code in several places but does not work, I do not declare variables at the end and asking how they are optional, my version is 1.9. Please help me.

Thanks
Ne Nashev への返信

Re: patch to make logs more readable and usable

- Rahim Ahmad の投稿

for moodle 1.9.10 version is the same code for time tracker..why i use this code in moodle 1.9.10 cannot run..please help me..