Raised This Month: $41 Target: $400
 10% 

Compiling AMXX Module


Post New Thread Reply   
 
Thread Tools Display Modes
Tirant
Veteran Member
Join Date: Jul 2008
Location: Los Angeles, California
Old 09-17-2015 , 04:47   Re: Compiling AMXX Module
Reply With Quote #11

It's a lot cleaner now that I've re-written the printf-like-logic. I decided to go with a different method which parses the string and then uses the same log based on the printf flags. This should be a lot easier to maintain or add new specifiers.

I added more detailed parser error reporting and validation of the format in the params. If an invalid format is used (e.g., when creating a Logger), then the error message will look something like:

Code:
L 09/17/2015 - 01:37:15: [LOGGER] Invalid logger name format provided: "[%5s] [%-6.4e] %n::%f %l" (position 8 = "%-6.4e")
L 09/17/2015 - 01:37:15: [AMXX] Displaying debug trace (plugin "test.amxx", version "unknown")
L 09/17/2015 - 01:37:15: [AMXX] Run time error 10: native error (native "LoggerCreate")
L 09/17/2015 - 01:37:15: [AMXX]    [0] test.sma::plugin_init (line 5)
I could/might take it a step further and enumerate the errors a bit, e.g., "Invalid specifier 'e' used" in the above case, however I believe this might be unnecessary. I'll create an FR for it though.

Let me know what you guys think, do you think LoggerModule will be of any use to you?
__________________

PM me if you're interested in buying the Credits addition for Base Builder
Battlefield Rebirth [66% done]
Call of Duty: MW2 [100% done]
Base Builder [100% done]
Tirant is offline
KliPPy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 09-17-2015 , 05:42   Re: Compiling AMXX Module
Reply With Quote #12

It's funny how this thread almost evolved into Tirant's personal blog.

I love the idea, it could be useful. Anything that makes debugging easier is great.
KliPPy is offline
Tirant
Veteran Member
Join Date: Jul 2008
Location: Los Angeles, California
Old 09-18-2015 , 03:37   Re: Compiling AMXX Module
Reply With Quote #13

Just like to keep people updated

I'm really looking for ideas or what other people want too. I'm trying not to base this completely around just my own needs and create something that is customizable.

Minus stack traces, it's pretty much ready to use. I just want to integrate a couple of calls into AMXX (e.g., so ERROR severity will also propagate to AMXX and be reported in the AMXX logs)
__________________

PM me if you're interested in buying the Credits addition for Base Builder
Battlefield Rebirth [66% done]
Call of Duty: MW2 [100% done]
Base Builder [100% done]
Tirant is offline
KliPPy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 09-18-2015 , 13:11   Re: Compiling AMXX Module
Reply With Quote #14

Do you know how to implement the stack trace within AMXX? Yes, it would be a very useful feature.
KliPPy is offline
Tirant
Veteran Member
Join Date: Jul 2008
Location: Los Angeles, California
Old 09-18-2015 , 16:50   Re: Compiling AMXX Module
Reply With Quote #15

Not yet. I should be able to create one from a pointer somewhere though. This mod should be compatible with the current amxx build, so I might create a pull request if people want it added. If it was directly integrated, it world be a lot easier, because then I'd have access to the amxx functions
__________________

PM me if you're interested in buying the Credits addition for Base Builder
Battlefield Rebirth [66% done]
Call of Duty: MW2 [100% done]
Base Builder [100% done]
Tirant is offline
Tirant
Veteran Member
Join Date: Jul 2008
Location: Los Angeles, California
Old 09-21-2015 , 01:26   Re: Compiling AMXX Module
Reply With Quote #16

I think that I will merge this module with the core AMXX in order to get the visibility I need to those functions. I think that's just a better change overall, because I've already had to copy over some of the API.
__________________

PM me if you're interested in buying the Credits addition for Base Builder
Battlefield Rebirth [66% done]
Call of Duty: MW2 [100% done]
Base Builder [100% done]
Tirant is offline
KliPPy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 09-21-2015 , 01:55   Re: Compiling AMXX Module
Reply With Quote #17

What exactly do you need from AMXX core in your project? Because some of its core functions are already exported.
KliPPy is offline
Tirant
Veteran Member
Join Date: Jul 2008
Location: Los Angeles, California
Old 09-21-2015 , 01:58   Re: Compiling AMXX Module
Reply With Quote #18

I know. I require most if not all of the debugging classes, which don't seem to be exported. I can cut out the classes, similar to what I have done for CPlugin, but there seem to be significantly more dependencies for the debugger, so I think it's tightly coupled (which makes sense since it's the debugger).
__________________

PM me if you're interested in buying the Credits addition for Base Builder
Battlefield Rebirth [66% done]
Call of Duty: MW2 [100% done]
Base Builder [100% done]
Tirant is offline
Tirant
Veteran Member
Join Date: Jul 2008
Location: Los Angeles, California
Old 09-21-2015 , 02:18   Re: Compiling AMXX Module
Reply With Quote #19

I just finished integrating it. I really wasn't that bad. I'm going to work on adding the stack traces tomorrow.
__________________

PM me if you're interested in buying the Credits addition for Base Builder
Battlefield Rebirth [66% done]
Call of Duty: MW2 [100% done]
Base Builder [100% done]
Tirant is offline
Tirant
Veteran Member
Join Date: Jul 2008
Location: Los Angeles, California
Old 09-23-2015 , 03:44   Re: Compiling AMXX Module
Reply With Quote #20

I added stack traces. I'm going to look at it a bit more to see if there any obvious improvements, but I think it's ready for a pull request.

I am also working on adding a cvar manager to manage the logger verbosities. Right now it only manages the global verbosity setting, however I'm going to add a forward to make it manage individual loggers as well, e.g., logger_%s_verbosity, where %s is the logger name. This is just to make it more convenient for servers running a plugin which uses this, as they may want to disable logging altogether.

Additionally, the default severities (verbosities) are:
[They are intended to be extensible, however numbers within the range belong to that verbosity, e.g., [301, INF) = ERROR, [201, 301) = WARN, etc.). In other words, you can specify your own severities in addition to the default ones]
Code:
enum Severity {
    Severity_Invalid = -1,
    Severity_None    = 0,
    Severity_Debug   = 1,
    Severity_Lowest  = Severity_Debug,
    Severity_Info    = 101,
    Severity_Warn    = 201,
    Severity_Error   = 301,
    Severity_Highest = Severity_Error
};
Current specifiers:
Code:
d date
f function
i counter (increments when the map changes, resets after midnight)
l line #
m map
n script name (e.g., plugin.sma)
p plugin name (e.g., plugin) [i.e., plugin.amxx without *.amxx]
s message
t time
v verbosity (or severity) [e.g., INFO, DEBUG, WARN, ERROR]
% %
Here is the native decl to create a logger
Code:
native Logger:LoggerCreate(
        const Severity:verbosity = Severity_Warn,
        const nameFormat[]  = "%p_%d",
        const msgFormat[]   = "[%5v] [%t] %n::%f - %s",
        const dateFormat[]  = "%Y-%m-%d",
        const timeFormat[]  = "%H:%M:%S",
        const pathFormat[]  = "",
        const traceFormat[] = "    at %n::%f : %l");
Please let me know if you have any suggestions or ideas.
__________________

PM me if you're interested in buying the Credits addition for Base Builder
Battlefield Rebirth [66% done]
Call of Duty: MW2 [100% done]
Base Builder [100% done]

Last edited by Tirant; 09-23-2015 at 03:58.
Tirant is offline
Old 09-24-2015, 02:57
Tirant
This message has been deleted by Tirant. Reason: I resolved this issue by passing the char pointer directly instead of using prepareCharArray
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:30.


Powered by vBulletin®
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Theme made by Freecode