Raised This Month: $ Target: $400
 0% 

How can i add logs to a plugin?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
K1d0x
Senior Member
Join Date: Apr 2012
Location: Copenhagen, Denmark
Old 05-20-2012 , 02:06   Re: How can i add logs to a plugin?
Reply With Quote #5

1
Quote:
log_amx("Plugin test")
2
Quote:
#define FILE "FILE_NAME.log"

public log_test() {
log_to_file(FILE, "Plugin test")
}
3
Quote:
#define HISTORY_IN_ONE_FILE // if you want to create logs only in one file add // before define

public log_test() {
Log("Plugin test")
}

Log(const message_fmt[], any:...)
{
static message[256];
vformat(message, sizeof(message) - 1, message_fmt, 2);

static filename[96];
#if defined HISTORY_IN_ONE_FILE
if( !filename[0] )
{
get_basedir(filename, sizeof(filename) - 1);
add(filename, sizeof(filename) - 1, "/logs/File_name.log");
}
#else
static dir[64];
if( !dir[0] )
{
get_basedir(dir, sizeof(dir) - 1);
add(dir, sizeof(dir) - 1, "/logs");
}

format_time(filename, sizeof(filename) - 1, "%m%d%Y");
format(filename, sizeof(filename) - 1, "%s/File_name_%s.log", dir, filename);
#endif

log_amx("%s", message);
log_to_file(filename, "%s", message);
}

Last edited by K1d0x; 05-20-2012 at 02:10.
K1d0x is offline
Send a message via Yahoo to K1d0x Send a message via Skype™ to K1d0x
 



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 00:29.


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