AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Message Logging (https://forums.alliedmods.net/showthread.php?t=7118)

DS 10-26-2004 21:15

Message Logging
 
4 Attachment(s)
Message Logging 1.17
by Damaged Soul

AMX Mod X Version: 1.75 and above
Supported Mods: All

Description
This plugin allows for the logging of any or all messages sent by the HL engine or mod (such as DeathMsg, CurWeapon, etc) It also allows these messages to be filtered by entity.

Information that is logged includes:
  • Message name
  • Number of message arguments
  • Message ID
  • Message destination (i.e. Broadcast, One, All, etc)
  • Message origin
  • Entity that received the message
  • Entity classname
  • Entity netname
  • Every argument value and type
Required Modules
Fakemeta

Usage
  • Console Commands
    • amx_msglog <command> [argument]
      • Displays help for logging engine/mod messages when no command is given
      • Commands:
        • start [msg name or id]
          • Starts logging given message or all if no argument
        • stop [msg name or id]
          • Stops logging given message or all if no argument
        • list [page]
          • Displays list of messages and their logging status
  • Cvars
    • amx_ml_filter [Default Value: 1]
      • Allows for filtering messages by entity index
      • Set this to the index of the entity for which you want to log messages
      • If this is set to 0, message logging will be done for all entities
    • amx_ml_logmode [Default Value: 1]
      • Determines where to log message information
      • Set this to 0 to log information to the standard AMX Mod X log file
      • Set this to 1 to log information to a separate file (messages.log) in the log directory
  • Examples
    • To log the DeathMsg message:
      • amx_msglog start DeathMsg OR amx_msglog start 83
    • To stop logging the DeathMsg message:
      • amx_msglog stop DeathMsg OR amx_msglog stop 83
    • To log all messages except the DeathMsg message:
      • amx_msglog start
      • amx_msglog stop DeathMsg OR amx_msglog stop 83
    • To log messages only sent to third player of the server:
      • amx_ml_filter 3
    • To log messages sent to all entities:
      • amx_ml_filter 0
Version History
  • 1.17 [Feb. 11, 2007]
    • Fixed: Long arguments were being reported as bytes (Thanks XxAvalanchexX)
  • 1.16 [Oct. 4, 2006]
    • Fixed: String arguments of messages that contained format paramaters (such as %s) caused runtime error 25 (thanks sawce :avast:)
    • Tabs and new-lines in string arguments of messages are now converted to ^t and ^n
  • 1.15 [July 4, 2006]
    • Now uses the Fakemeta module instead of Engine
    • Now uses vformat instead of the deprecated format_args when logging information
    • Very minor optimizations
  • 1.11 [May 11, 2006]
    • Fixed: String arguments of messages were being logged as numbers
  • 1.10 [Apr. 23, 2006]
    • Minor optimizations including the use of pcvar natives to improve performance a bit
    • Much of the logged text has been rewritten in an attempt to make it more like the Half-Life log standard
    • Now when using the start or stop commands on a specified message, both the message name and ID are printed instead of just whatever was given as the argument
    • Added: amx_ml_logmode cvar for controlling where to log message information
    • Fixed: When no arguments were given to amx_msglog, usage information was not printed
  • 1.03 [Oct. 26, 2004]
    • Public release
    • Fixed: Entity filter wasn't actually checking for valid entities correctly (thanks JGHG)
  • 1.02 [Oct. 25, 2004]
    • Fixed: If logging had been started for a message, stopped, then started again, same message was logged twice.
    • Fixed: If message name or ID was invalid, started/stopped logging all messages instead
  • 1.01 [Oct. 23, 2004]
    • Fixed: List command was not reporting correct logging status
    • Fixed: Filter was incorrectly filtering messages if amx_ml_filter was 0
  • 1.00 [Oct. 19, 2004]
    • Initial version

Johnny got his gun 10-27-2004 08:27

As far as messages go, this is likely a one-stop shop for everything headed there. :-)

pendragon 10-28-2004 02:45

agreed - I'm glad u ventured into this plugin. THanks.
Could you possibly make this so that it creates the logs in a sql server?

Johnny got his gun 10-28-2004 08:11

Why on earth would you want that??

DS 10-28-2004 10:41

I would like to know why you would need that. Depending on what messages you are logging, I would think there would be some fairly high traffic (most especially if you are logging ALL messages) between the game and SQL servers. It's more or less just one of those plugins you'd probably only run once in awhile anyways if you're trying to figure out how a certain message works for a plugin you're developing.

BigBaller 10-28-2004 11:01

Yea I think this is more of a developers friendly plugin only needed for some projects that realy heavy on deathmsg and such. Maybe some of the warcraft coders could benfit from this I wouldnt know but I can tell you it would be a big help for anyone learning to script.

I do have to give you a A+ for presentation and organization, very understandable format :)

Lasershock 10-29-2004 11:06

i have a small question:

i have a entmod server on svencoop does this plugin log everything that all my entadmins type in console??? so i can easy check who crashed the server

and btw failed to compile for 0.20

DS 10-29-2004 12:47

Yes, you're right it doesn't compile using the online compiler. I hadn't noticed this. But this is most likely because the inc files haven't been updated for it yet. It should compile fine if you download the sma and have 0.20 RC7 though.

As for your question. No this has nothing to do with logging what commands people type or what people say. Although in a round-about way you could log what people say using this with the SayText message. But this is not what the plugin is meant for.

BAILOPAN 10-29-2004 12:59

Include files updated. It should compile now.

This plugin looks very useful, good job :D

Lasershock 10-29-2004 14:06

Quote:

Originally Posted by Damaged Soul
As for your question. No this has nothing to do with logging what commands people type or what people say. Although in a round-about way you could log what people say using this with the SayText message. But this is not what the plugin is meant for.


maybe you can make a plugin thats does it :roll: P???
just because youre so good :wink:


im gonna post this in request forum

v3x 02-18-2006 16:28

Oh damn, this is nice.

pendragon 02-18-2006 21:48

Quote:

Originally Posted by v3x
Oh damn, this is nice.

Funny, you brought it back from the dead (this thread) but it gave me a chance to allow to reply to JGHG cause i never did....

Yes! :D Its mostly for when I help out with new plugins so I can just refer them to a page with any messages sent by the hl engine when i test out their plugins.

But that was 2 years ago - I'm over it :twisted:

VEN 02-20-2006 12:14

This plugin is very useful (always wanted to said that).

DS 04-23-2006 06:57

After over a year, I have finally updated this plugin. Although it may not have needed much of anything...

Only a few things you might notice without looking at the source:
I have added a new cvar for controlling whether the message info gets logs to the standard AMXX log file or to a separate file (messages.log). By default it is set for a separate file. (Personally I think it is better this way as what goes on in the server really should be separate from information you are trying to get for developing your plugin.)

Also, the formatting of the logged text has changed quite a bit, but all the same information is still there.

Edit: Version 1.11 has now been released which fixes a rather stupid bug that cropped up in 1.10 where string arguments were logged as numbers. Thanks to BAILOPAN for finding it.

diamond-optic 05-11-2006 21:13

not a big deal...

but i noticed when i got the 1.11 off the CVS that the version numbers in the code werent updated from 1.10... then i checked here and saw that they are also 1.10 in the code...

like i said, nothing major.. just thought i'd let ya know :)

DS 05-12-2006 00:04

Heh, wow, can't believe I forgot about that. Thanks for letting me know. It's now been updated in both places now. (I didn't think anyone ever had looked at that CVS repository, heh)

diamond-optic 05-12-2006 11:43

lol i check thru the amxx cvs almost daily lol.. im a loser & get extremely bored lol... especially now since the dodplugins cvs doesnt seem to load in my browser lol (tho it still seems i can still commit updates to my plugins on it....)

SS. Kommando 05-19-2006 17:25

A simple question: will this make the server more stable?

noob cannon lol 05-19-2006 17:26

no- it's a tool for developers

DS 07-04-2006 16:51

Re: Message Logging
 
A new minior version (1.15) has been released. It no longer relies on the Engine module thanks to some natives that were moved into the AMXX core. For those that do not like Engine, that may be good news. It does however require Fakemeta now.

diamond-optic 07-05-2006 19:20

Re: Message Logging
 
:)

this plugin has helped me countless times...

great stuff! lol

Ramono 09-10-2006 08:45

Re: Message Logging
 
This plugin is realy nice
But i have a little request:

Code:

amx_blockmsg "messageid"
causes funciton
set_msg_block(messageid,BLOCK_SET)

Code:

amx_unblockmsg "messageid"
causes funciton
set_msg_block(messageid,BLOCK_NOT)

and maybe:
amx_sendmessage(messageid,parm1,parm2,parm3,e tc...)
a int may me like this
"int 1"
string
"string blabla"

sawce 10-04-2006 02:05

Re: Message Logging
 
A string as an argument containing a valid format parameter (eg: "%s") will cause it to throw an error.

Changing log_msgf to:
Code:
/* Writes messages to log file depending on value of amx_ml_logmode */ log_msgf(const fmt[], {Float,Sql,Result,_}:...) {           static buffer[512]     vformat(buffer, 511, fmt, 2)         replace(buffer,511,"%","%%") // stop %s from messing it up         if (get_pcvar_num(g_cvarLogMode))         log_to_file(LOGFILE_NAME, buffer)     else         log_amx(buffer) }

fixes it

ps: hi ds

DS 10-04-2006 07:22

Re: Message Logging
 
Quote:

Originally Posted by sawce (Post 387377)
A string as an argument containing a valid format parameter (eg: "%s") will cause it to throw an error.

Hello sawce :gyar:

Thanks for finding this bug. It is now fixed in 1.16 along with a change to convert new-lines and tabs to ^n and ^t so the log file doesn't get stretched.

(Now Mr. Werror shall die of shame :sadpirate:)

diamond-optic 10-04-2006 18:28

Re: Message Logging
 
awesome lol i love this plugin.. probably the most useful thing here

Herb1e 11-01-2006 00:26

Re: Message Logging
 
Hi!
I need help with this plugin. I installed and its working but I want to log only chat messages and admin chat. How to do that?

sawce 11-01-2006 02:01

Re: Message Logging
 
Quote:

Originally Posted by Herb1e (Post 398068)
Hi!
I need help with this plugin. I installed and its working but I want to log only chat messages and admin chat. How to do that?

If you actually want to log the raw user message, hook TextMsg.

If you just want to see what your users are saying this isnt the plugin for you (its meant for developers), turn logging on ("log on" in console / some cfg file, or start hlds with the "+log on" option)

Herb1e 11-01-2006 06:23

Re: Message Logging
 
Yes I want to see what they are saying. I have logging enabled, but it is very difficult to find it in the log file. :(

diamond-optic 11-01-2006 09:34

Re: Message Logging
 
well adminchat messages are also saved to the AMXX log files.. so theres a little less clutter in those for you to go thru...

XxAvalanchexX 12-30-2006 17:43

Re: Message Logging
 
I assume Damaged Soul isn't around anymore, but I wanted to point out anyway that Longs say that they are Bytes. Very confusing! The fix is easy, however.

Very nice work, though, DS, I use this plugin all the time.

VEN 01-09-2007 10:15

Re: Message Logging
 
Sometimes it may be useful to log only a messages which isn't sent to the specific entity (dest. ALL/BROADCAST/etc). I've made such change a long time ago and use this feature sometimes. Just thought that you might want to implement something like that...

Simon Logic 02-06-2007 15:42

Re: Message Logging
 
1 Attachment(s)
Yes, this is great plugin. But I hate one error which cause a crash of HL. I'm just running listen server, start logging for player ID#1 and execute in console "sv_restart 1". One second later i get picture below.

Also i get this crash in other cases from time to time.

DS 02-12-2007 00:11

Re: Message Logging
 
I've released a quick update (1.17) to fix the longs being reported as bytes bug. Thank you Avalanche.

Quote:

Originally Posted by VEN (Post 425301)
Sometimes it may be useful to log only a messages which isn't sent to the specific entity (dest. ALL/BROADCAST/etc). I've made such change a long time ago and use this feature sometimes. Just thought that you might want to implement something like that...

For a long while, I've wanted to rewrite this plugin almost from scratch. And filtering in different ways is something on my to-do list. So, VEN, your idea is something I am planning on (among other things).

However, I don't know when I'll be able to get to it. Since I've come back, I have been pretty busy doing some work on SourceMod. So maybe when that slows down, I'll be able to come back to this.


All times are GMT -4. The time now is 13:42.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.