Simple Logger

Share your scripts and packages with other Mudlet users.
syrik
Posts: 90
Joined: Sat Jun 26, 2010 9:57 pm

Re: Simple Logger

Post by syrik » Mon Nov 22, 2010 12:41 am

How would I go about making one using screendump?

User avatar
Proxy
Posts: 27
Joined: Sun May 08, 2016 4:57 pm

Re: Simple Logger

Post by Proxy » Tue Jun 21, 2016 7:42 am

Is there any way this logger could be used to catch echos sent by an alias or trigger?

User avatar
Belgarath
Posts: 232
Joined: Fri Jul 26, 2013 7:19 am
Discord: macjabeth#2283

Re: Simple Logger

Post by Belgarath » Fri Jun 24, 2016 4:41 pm

Code: [show] | [select all] lua
local oldecho = echo
function echo(str)
  oldecho(str)
  if Logger.trigger_id then
    Logger:Log(Logger.logging_file, str)
  end
end

User avatar
Proxy
Posts: 27
Joined: Sun May 08, 2016 4:57 pm

Re: Simple Logger

Post by Proxy » Wed Jun 29, 2016 11:51 pm

Thank you so much, Belgarath! I have been trying to get that done for soo bloody long. Much appreciated!

User avatar
Proxy
Posts: 27
Joined: Sun May 08, 2016 4:57 pm

Re: Simple Logger

Post by Proxy » Thu Jul 14, 2016 2:33 pm

I know I have been a pain in the ass, but is there any way that this logger could be used to append all logs to a single text file? In other words whenever you log in, that days log just gets added to the file and so on, leaving only one neat text file in you directory. I tried fiddling around with it but couldn't figure how to do it. Assuming the name of the file was "Test", how would I set this up, if at all possible?

Thank you all for your help

User avatar
SlySven
Posts: 919
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Simple Logger

Post by SlySven » Fri Jul 15, 2016 10:46 pm

The normal "C" code way is to open the file in an "append" mode rather than a "create" mode - and given that Lua is built from C I suspect there is a way to tell it to open a fixed name file (rather than creating a new one each time based on the current day or whatever) in append mode.

RTFM as they say and, if it is the Lua io library that is being used, the bit of the M you ought to R is here... :P

User avatar
Proxy
Posts: 27
Joined: Sun May 08, 2016 4:57 pm

Re: Simple Logger

Post by Proxy » Thu Jul 21, 2016 8:56 am

Thanks for the tip, SlySven! :)

kitchen
Posts: 5
Joined: Mon Jan 08, 2018 6:32 am

Re: Simple Logger

Post by kitchen » Mon Apr 29, 2019 5:08 pm

This is neat an real helpful. Thanks for making the script!

Quick question: is there a way to make it so that it doesn't log the same thing twice. As in it will detect if there's a duplicate entry contained in the log and stop logging if the information is already contained in the log.

What I'm using it for is logging when I identify an item and don't need to have duplicate log entries if I identify the same item twice.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests