1. Post #1
    Skondra's Avatar
    June 2009
    333 Posts
    Description:

    This module allows you to filter/log/process spew messages in Lua. For a detailed explanation of the spew system, check out dbg.h in the SDK.

    SVN:

    http://christopherthorne.googlecode....gm_enginespew/
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Friendly Friendly x 4Useful Useful x 2 (list)

  2. Post #2
    Gold Member
    slayer3032's Avatar
    November 2007
    3,498 Posts
    Holy shit, why hasn't anyone seen this yet?

    Isn't this the Console Output hook that everyone was requesting two weeks ago?
    Reply With Quote Edit / Delete Reply United States Show Events Agree Agree x 5Friendly Friendly x 1 (list)

  3. Post #3
    Exitus's Avatar
    January 2005
    56 Posts
    Yeah, but we all wanted it to be an official part of garrysmod =(

    Oh well, this will do rather nicely instead!
    Reply With Quote Edit / Delete Reply Show Events Friendly Friendly x 3Disagree Disagree x 1Bad Reading Bad Reading x 1 (list)

  4. Post #4
    Gold Member
    blackops7799's Avatar
    December 2006
    1,714 Posts
    Hah, pretty cool.

    http://i48.tinypic.com/1y5lwm.jpg

    It seems to split up lines sometimes though.
    Reply With Quote Edit / Delete Reply United States Show Events Artistic Artistic x 1 (list)

  5. Post #5
    Gold Member
    Kill coDer's Avatar
    April 2006
    956 Posts
    Thanks for this, very useful!
    Reply With Quote Edit / Delete Reply Australia Show Events Agree Agree x 1 (list)

  6. Post #6
    Gold Member
    Lexic's Avatar
    March 2009
    6,123 Posts
    Isn't this the Console Output hook that everyone was requesting two weeks ago?
    It could be used as such, but it's (in my opinion) far more useful feature is the ability to hide console output, ie the annoying spammy red errors.
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Agree Agree x 1 (list)

  7. Post #7
    Skondra's Avatar
    June 2009
    333 Posts
    Isn't this the Console Output hook that everyone was requesting two weeks ago?
    If you just want to log console output (on the client) then haza55's module is probably better.

  8. Post #8
    Gold Member
    Gbps's Avatar
    December 2008
    3,645 Posts
    Pure genius. Just pure genius.
    Reply With Quote Edit / Delete Reply United States Show Events Dumb Dumb x 2Optimistic Optimistic x 1 (list)

  9. Post #9
    Dragon Dildoes
    Dennab
    April 2009
    4,432 Posts
    If you just want to log console output (on the client) then haza55's module is probably better.
    Recent update broke gmcl_menusystem.

    Code:
    error loading module 'menusystem' from file 'f:\steam\steamapps\que_tion\garrysmod\garrysmod\lua\includes\modules\gmcl_menusystem.dll':
    	Die angegebene Prozedur wurde nicht gefunden.

    Thank you garry... once again.
    Reply With Quote Edit / Delete Reply Germany Show Events Dumb Dumb x 1 (list)

  10. Post #10
    Box collector
    haza55's Avatar
    October 2005
    545 Posts
    Updated gmcl_menusystem.
    Reply With Quote Edit / Delete Reply Australia Show Events Friendly Friendly x 1 (list)

  11. Post #11

    November 2009
    44 Posts
    Chris, would you be willing to set up a public svn for all of your public projects, like what Azu has?

  12. Post #12
    yakahughes's Avatar
    April 2008
    1,318 Posts
    Most, if not all of his public projects are on his website, and there are only a very few that he updates.

  13. Post #13
    Dragon Dildoes
    Dennab
    April 2009
    4,432 Posts
    Updated gmcl_menusystem.
    Thank you much.

    I was happy too early...

    It crashes on the first console message after it has being required... fix it please.

  14. Post #14
    Skondra's Avatar
    June 2009
    333 Posts
    Chris, would you be willing to set up a public svn for all of your public projects, like what Azu has?
    After my site shuts down (some time this month) I'm going to be uploading everything to http://code.google.com/p/chrisaster/source/browse/.
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Agree Agree x 1Dumb Dumb x 1 (list)

  15. Post #15
    Dragon Dildoes
    Dennab
    April 2009
    4,432 Posts
    Would you please fix gmcl_menusystem haza, its still broken...

  16. Post #16
    Skondra's Avatar
    June 2009
    333 Posts
    I've just updated the link which now contains a Linux-compatible binary as well as a minor update.

    The hook passes 2 extra arguments - group and level. Group is usually something like "developer" (string) and level is the importance of the message (5 being the most important, from what I've seen).

  17. Post #17
    likes men
    Python1320's Avatar
    May 2007
    1,722 Posts
    Linux version working with the latest engine: http://g.iriz.org/~srcds/modules/

  18. Post #18
    CyberGmod Founder PropHuntv2 Home
    Phoenixf129's Avatar
    May 2009
    1,030 Posts
    This seems to crash my server.

    Not sure why though.

    Dumps provided:

    http://cybergmod.net/dl/dumps.rar

  19. Post #19
    likes men
    Python1320's Avatar
    May 2007
    1,722 Posts
    The only reason I can think of is infinite loop. While you're in the hook if you call print or you error or do basically anything the hook gets recalled.
    Reply With Quote Edit / Delete Reply Finland Show Events Informative Informative x 1 (list)

  20. Post #20
    IS AWESOME@@@@@@@@@@

    January 2009
    968 Posts
    The dump file tells me it failed to push hook.Call onto the stack, probably because of what Python said. If the hook is called too rapidly (most likely because of a recursive loop) then it crashes.
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Informative Informative x 1 (list)

  21. Post #21
    CyberGmod Founder PropHuntv2 Home
    Phoenixf129's Avatar
    May 2009
    1,030 Posts
    Is this preventable in any way?

    (Rated informative.)

  22. Post #22
    IS AWESOME@@@@@@@@@@

    January 2009
    968 Posts
    Is this preventable in any way?

    (Rated informative.)
    I could reference the hook.Call function to prevent the crash but your console would still be spammed. You shouldn't be calling print/Msg/etc inside the hook because that causes a loop.

  23. Post #23
    Gold Member
    Lexic's Avatar
    March 2009
    6,123 Posts
    if (message:sub(1,6) ~= "[spew]") then
        Msg("[spew]",message);
    end
    ?

  24. Post #24
    likes men
    Python1320's Avatar
    May 2007
    1,722 Posts
    Snippet from one of my projects:

    	function OnLuaError(str)
    		if InEPOE or HasNoSubs then return end
    		
    		InEPOE = true
    			
    			if HitMaxQueue() then return end
    			
    			EnableTick()
    
    			PushPayload( IS_ERROR , str )
    		
    		InEPOE=false
    	end
    
    
    		hook.Add("EngineSpew", TagHuman, function(spewType, msg, group, level) 
    			if spewType != SPEW_WARNING then return end
    			OnLuaError( msg  )
    		end )
    

  25. Post #25
    Map in a box's Avatar
    July 2009
    7,413 Posts
    can get 64bit edition?
    Reply With Quote Edit / Delete Reply United States Show Events Dumb Dumb x 2Funny Funny x 1 (list)

  26. Post #26
    likes men
    Python1320's Avatar
    May 2007
    1,722 Posts
    can get 64bit edition?
    what? gmod is not 64
    Reply With Quote Edit / Delete Reply Finland Show Events Funny Funny x 1 (list)

  27. Post #27
    Gold Banana
    Banana Lord.'s Avatar
    May 2010
    6,852 Posts
    since when are modules architecture-dependent?

    just OS dependent

  28. Post #28
    I'm Better Than You
    Handsome Matt's Avatar
    August 2008
    5,605 Posts
    since when are modules architecture-dependent?
    Since they use external libraries. (gm_chrome (awesomeness thing) / gm_bass (bass) / gm_mysql (libmysql))

  29. Post #29
    Gold Member
    Clavus's Avatar
    September 2009
    6,324 Posts
    I found this module pretty handy but there's a massive problem with it:

    Code:
    Tried to pop off the top ( Stack is 0, tried to pop 1 )!
    Starts showing up in the Lua error log when you run the server for a prolonged time with lots of players. It causes massive instability (our server crashed pretty much every hour). Somebody in the Niggles thread already diagnosed it's caused by this module.

    This was my code:
    require( "enginespew" )
    
    local SPEW_WARNING = 1
    
    hook.Add( "EngineSpew", "LuaErrorToAdmins", function( spewType, msg, group, level )
    
    	if (spewType == SPEW_WARNING) then
    		for k, v in pairs( player.GetAll() ) do
    			if (v:IsAdmin()) then
    				v:SendLua( "ErrorNoHalt('[SERVER WARNING] "..string.gsub( msg, "\n", "" ).."')" )
    			end
    		end
    	end
    	
    end )

  30. Post #30
    likes men
    Python1320's Avatar
    May 2007
    1,722 Posts
    I found this module pretty handy but there's a massive problem with it:

    Code:
    Tried to pop off the top ( Stack is 0, tried to pop 1 )!
    Starts showing up in the Lua error log when you run the server for a prolonged time with lots of players. It causes massive instability (our server crashed pretty much every hour). Somebody in the Niggles thread already diagnosed it's caused by this module.

    This was my code:
    require( "enginespew" )
    
    local SPEW_WARNING = 1
    
    hook.Add( "EngineSpew", "LuaErrorToAdmins", function( spewType, msg, group, level )
    
    	if (spewType == SPEW_WARNING) then
    		for k, v in pairs( player.GetAll() ) do
    			if (v:IsAdmin()) then
    				v:SendLua( "ErrorNoHalt('[SERVER WARNING] "..string.gsub( msg, "\n", "" ).."')" )
    			end
    		end
    	end
    	
    end )
    You could use EPOE for this. ( http://www.facepunch.com/threads/101...tion-Of-Errors )
    It hasn't caused instability for me at least. Use the SVN version.

  31. Post #31
    IS AWESOME@@@@@@@@@@

    January 2009
    968 Posts
    Any crashes are probably caused by threaded spew. I'll write up a workaround soon.
    Reply With Quote Edit / Delete Reply Windows 7 United Kingdom Show Events Friendly Friendly x 2 (list)

  32. Post #32
    IS AWESOME@@@@@@@@@@

    January 2009
    968 Posts
    I've committed a partial fix (the module now ignores threaded spew, this is temporary) for Windows users just to make sure threading is the root of the problem. It would be helpful if someone running a Windows server could test it out and let me know if it's stable.

  33. Post #33
    Gold Member
    Clavus's Avatar
    September 2009
    6,324 Posts
    I've committed a partial fix (the module now ignores threaded spew, this is temporary) for Windows users just to make sure threading is the root of the problem. It would be helpful if someone running a Windows server could test it out and let me know if it's stable.
    I've been using it for over a day now and since my server isn't crashing every other hour (like before), I guess you fixed it.

  34. Post #34
    Gold Member
    BlackAwps's Avatar
    July 2011
    771 Posts
    I've noticed this module has been crashing my linux server recently.

    require( "enginespew" )
    
    SPEW_MESSAGE = 0
    SPEW_WARNING = 1
    SPEW_ASSERT = 2
    SPEW_ERROR = 3
    SPEW_LOG = 4
    
    hook.Add( "EngineSpew", "ErrorAdminLogging", function( spewType, msg, group, level )
    
    	if spewType != SPEW_LOG and spewType != SPEW_MESSAGE then
    	
    		msg = string.sub( msg, 1, -2 )
    
    		local recepFilter = RecipientFilter()
    		for _,v in pairs( player.GetAll() ) do
    			if v:IsUltraAdmin() or v:IsSuperAdmin() or v:IsDEV() or v:IsAdmin() then
    				recepFilter:AddPlayer( v )
    			end
    		end
    		umsg.Start( "NotifyLogger", recepFilter )
    			umsg.String( msg )
    			umsg.Short( spewType )
    		umsg.End()
    		BAdmin:Log( msg, true )
    		
    	end
    end )

    This is how I am currently using it. I first noticed it today when this lua error occurred right before a crash.

    Code:
    attempt to concatenate a userdata value
    attempt to concatenate a userdata value
    table
    Hook 'ErrorAdminLogging' Failed: table: 0xea96c348
    attempt to call a nil value
    I'm not exactly sure what happened, but it looks like something was a table when it shouldn't have been, it errored then created an infinite loop?

    I looked up in my error log and noticed a few more strange errors circling around my error hook.

    Code:
    attempt to 
    attempt to call a number value
    nil
    @lua/includes/modules/hook.luabad argument #1 to '?' (ErrorAdminLogging)
    Tried to pop off the top ( Stack is 0, tried to pop 2 )!
    Hook 'function: 0xea75d3e8' Failed: attempt to call a table value
    attempt to
    Code:
    attempt to concatenate a function value
    [lua/includes/modules/hook.lua:-1] attempt to call a string value
    
    [lua/includes/modules/hook.lualua/includes/modules/hook.lua:-1] callcall a nil value value
    attempt to call a userdata value
    Hook 'ErrorAdminLogging' Failed: attempt to concatenate a table value
    (null)
    Hook 'ErrorAdminLogging' Failed: attempt to index a string value
    attempt to call a string value
    I think this may be a threading issue, seeing how the stack looks like it's all out of order when erroring.

    Here's a dumpfile that was created during my latest crash.

    http://dl.dropbox.com/u/38214687/cra...16170933_1.dmp
    And another one from this morning
    http://dl.dropbox.com/u/38214687/cra...16103740_1.dmp

  35. Post #35
    IS AWESOME@@@@@@@@@@

    January 2009
    968 Posts
    I've noticed this module has been crashing my linux server recently.

    require( "enginespew" )
    
    SPEW_MESSAGE = 0
    SPEW_WARNING = 1
    SPEW_ASSERT = 2
    SPEW_ERROR = 3
    SPEW_LOG = 4
    
    hook.Add( "EngineSpew", "ErrorAdminLogging", function( spewType, msg, group, level )
    
    	if spewType != SPEW_LOG and spewType != SPEW_MESSAGE then
    	
    		msg = string.sub( msg, 1, -2 )
    
    		local recepFilter = RecipientFilter()
    		for _,v in pairs( player.GetAll() ) do
    			if v:IsUltraAdmin() or v:IsSuperAdmin() or v:IsDEV() or v:IsAdmin() then
    				recepFilter:AddPlayer( v )
    			end
    		end
    		umsg.Start( "NotifyLogger", recepFilter )
    			umsg.String( msg )
    			umsg.Short( spewType )
    		umsg.End()
    		BAdmin:Log( msg, true )
    		
    	end
    end )

    This is how I am currently using it. I first noticed it today when this lua error occurred right before a crash.

    Code:
    attempt to concatenate a userdata value
    attempt to concatenate a userdata value
    table
    Hook 'ErrorAdminLogging' Failed: table: 0xea96c348
    attempt to call a nil value
    I'm not exactly sure what happened, but it looks like something was a table when it shouldn't have been, it errored then created an infinite loop?

    I looked up in my error log and noticed a few more strange errors circling around my error hook.

    Code:
    attempt to 
    attempt to call a number value
    nil
    @lua/includes/modules/hook.luabad argument #1 to '?' (ErrorAdminLogging)
    Tried to pop off the top ( Stack is 0, tried to pop 2 )!
    Hook 'function: 0xea75d3e8' Failed: attempt to call a table value
    attempt to
    Code:
    attempt to concatenate a function value
    [lua/includes/modules/hook.lua:-1] attempt to call a string value
    
    [lua/includes/modules/hook.lualua/includes/modules/hook.lua:-1] callcall a nil value value
    attempt to call a userdata value
    Hook 'ErrorAdminLogging' Failed: attempt to concatenate a table value
    (null)
    Hook 'ErrorAdminLogging' Failed: attempt to index a string value
    attempt to call a string value
    I think this may be a threading issue, seeing how the stack looks like it's all out of order when erroring.

    Here's a dumpfile that was created during my latest crash.

    http://dl.dropbox.com/u/38214687/cra...16170933_1.dmp
    And another one from this morning
    http://dl.dropbox.com/u/38214687/cra...16103740_1.dmp
    It's the same threading issue Windows had but I didn't patch the Linux build because it didn't use multithreading at the time. Python1320 compiled a fixed version for use with EPOE, which you can get here.
    Reply With Quote Edit / Delete Reply Windows 7 United Kingdom Show Events Friendly Friendly x 1 (list)

  36. Post #36
    CyberGmod Founder PropHuntv2 Home
    Phoenixf129's Avatar
    May 2009
    1,030 Posts
    C stack overflow

    Caused today.

    GMod update at fault?

    EDIT:// Nah. Just my shitty coding.