Raised This Month: $51 Target: $400
 12% 

mkdir needed to create folder in /logs?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fatal_nl
Member
Join Date: Apr 2017
Old 05-21-2019 , 19:55   mkdir needed to create folder in /logs?
Reply With Quote #1

Is it necessary to do a directory check and a mkdir to use log_to_file to a specific directory?

Default it logs to /addons/amxmodx/logs and I want it to log to /addons/amxmodx/logs/my_plugin_logs

It needs to be Windows and Linux compatible.
fatal_nl is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-21-2019 , 22:36   Re: mkdir needed to create folder in /logs?
Reply With Quote #2

What happened when you tried it?
__________________
fysiks is offline
fatal_nl
Member
Join Date: Apr 2017
Old 05-22-2019 , 05:32   Re: mkdir needed to create folder in /logs?
Reply With Quote #3

I have it now like this below. For some reason mkdir chmod's the directory to 0700, which should be 0755.

Code:
#include <amxmodx> #include <amxmisc> #include <geoip> new szName[32], szIP[17], szID[25], szCountry[41] public plugin_init() {     register_plugin("AllinfoIP", "1.12b", "fatal") } public client_connect(id) {     new AmxxLogsDir[20], LogFilesDir[28], LogFileName[28], LogFile[56]         get_localinfo("amxx_logs", AmxxLogsDir, charsmax(AmxxLogsDir))         formatex(LogFilesDir, charsmax(LogFilesDir), "%s/allinfo", AmxxLogsDir)         if(!dir_exists(LogFilesDir))         mkdir(LogFilesDir)         get_time("allinfo_players_%m_%Y.txt", LogFileName, charsmax(LogFileName))         formatex(LogFile, charsmax(LogFile), "%s/%s", LogFilesDir, LogFileName)         get_user_name(id, szName, charsmax(szName))     get_user_authid(id, szID, charsmax(szID))     get_user_ip(id, szIP, charsmax(szIP), 1)     geoip_country(szIP, szCountry, charsmax(szCountry))         if (!is_user_bot(id))     {         log_to_file(LogFile, "     %s  |  %s  |  %s  |  %s", szName, szIP, szID, szCountry)     }         return PLUGIN_HANDLED }
fatal_nl is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 05-25-2019 , 14:34   Re: mkdir needed to create folder in /logs?
Reply With Quote #4

Immunitize it.
chattr +i <dir> [lin32] Logged in as root / sudo.
attrib +r <dir> [win32] Logged in as admin / runas.


Quote:
pawn is weak on data structuring because pawn
programs are intended to manipulate objects (text, sprites, streams, queries,
. . . ) in the host application, but the pawn program is, by intent, denied
direct access to any data outside its abstract machine. The only means that
a pawn program has to manipulate objects in the host application is by
calling subroutines, so called “native functions”, that the host application
provides
Snipped from:
The Language
November 2006
__________________
DJEarthQuake is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 05-25-2019 , 15:56   Re: mkdir needed to create folder in /logs?
Reply With Quote #5

No you don't.
__________________
Relaxing is offline
Reply



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 03:39.


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