View Single Post
Tirant
Veteran Member
Join Date: Jul 2008
Location: Los Angeles, California
Old 09-15-2015 , 01:03   Re: Compiling AMXX Module
Reply With Quote #8

I was able to successfully implement my idea. The code started getting a bit ugly because I didn't write any new functions to assist with the copying, but it works. Next step is to clean up what I've done and add two remaining features:

1) get calling function name (so in the logs one could have plugin::function, like in C)
2) add option to print stack trace following the message (this will be default for WARN and ERROR severities) The idea is to have format similar to Java (so this format may be fixed, however that is not out of the question to change):
Code:
exception in thread "main" java.lang.NullPointerException
        at com.example.myproject.Book.getTitle(Book.java:16)
        at com.example.myproject.Author.getBookTitles(Author.java:25)
        at com.example.myproject.Bootstrap.main(Bootstrap.java:14)
E.g.:
Code:
[ERROR] [21:54:38] [plugin1.sma::function1] Reason: Invalid handle specified (4)
        at function1(plugin1.sma:11)
        at function2(plugin2.sma:11)
        at function3(plugin2.sma:12)
I've uploaded a file generated using:

Code:
new Logger:logger = LoggerCreate(
        .verbosity = DEFAULT_LOGGER_VERBOSITY,
        .nameFormat = "loggerTest_%d",
        .msgFormat = "[%s] [%t] %n::%f %l",
        .dateFormat = "%Y-%m-%d",
        .timeFormat = "%H:%M:%S",
        .path = "");
LoggerSetVerbosity(logger, Severity_Debug);
LoggerLog(logger, Severity_Debug, "This is test %d", 1);
LoggerLog(logger, Severity_Info, "This is %s %f", "test", 2.0);
LoggerLog(logger, Severity_Warn, "This is test 3");
LoggerLog(logger, Severity_Error, "This is test 4");

LoggerLog(logger, Severity_Error, "This is a test with %s", "Exta stuffz");
LoggerDestroy(logger);
You can see already that this module offers a lot more flexibility in formatting logs the way you want, to see the messages you want to see.
Attached Files
File Type: log loggerTest_2015-09-14.log (299 Bytes, 156 views)
__________________

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-15-2015 at 01:06.
Tirant is offline