Author Topic: Write to log?  (Read 347 times)

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
Write to log?
« on: June 18, 2012, 07:52:37 pm »


               Somebody suggested that they have a script write to a log on the server and when the server restarts they use an outside script ((batch, bash, whatever)) to parse the log to delete or remove toons from the servervault.

My question is, how can use a script to intentionally write to a log?
               
               

               
            

Legacy_Thayan

  • Sr. Member
  • ****
  • Posts: 435
  • Karma: +0/-0
Write to log?
« Reply #1 on: June 18, 2012, 08:06:59 pm »


               Use the WriteTimestampedLogEntry() or PrintString() function. For example, from the Lexicon:


// This call would produce "[Fri Jul 12 12:08:03] Test" in the log file
WriteTimestampedLogEntry("Test");

The logfile the string is printed in is called nwclientlog.txt and is located in the "logs" folder under your nwn install directory.
               
               

               


                     Modifié par Thayan, 18 juin 2012 - 07:08 .
                     
                  


            

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
Write to log?
« Reply #2 on: June 18, 2012, 08:47:22 pm »


               Brilliant! I'll play with that. Thank you kindly Thayan!
               
               

               
            

Legacy_acomputerdood

  • Sr. Member
  • ****
  • Posts: 378
  • Karma: +0/-0
Write to log?
« Reply #3 on: June 19, 2012, 01:42:52 pm »


               using outside programs to parse your logfile to do stuff is very powerful.  your imagination is the limit with the things you can do.

we've used it for a player status/tracking system, announcement of special victories or dragon slayings, triggers to automatically update forum posts, and of course, player deletions.

of course, we've been moving away from the log file entry system in favor of a slicker nwnx database system.  but the log file is still a great place to start.
               
               

               


                     Modifié par acomputerdood, 19 juin 2012 - 12:43 .
                     
                  


            

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
Write to log?
« Reply #4 on: June 19, 2012, 05:31:17 pm »


               I'm not sure why I haven't been attracted to nwnx2 yet. I have MySQL already running on the server. Maybe I just don't know enough about the benefits and creative options.
               
               

               
            

Legacy_acomputerdood

  • Sr. Member
  • ****
  • Posts: 378
  • Karma: +0/-0
Write to log?
« Reply #5 on: June 19, 2012, 05:58:53 pm »


               at the risk of spamming my own nwvault submissions:

http://nwvault.ign.c....Detail&id=3627
http://nwvault.ign.c....Detail&id=3838
http://nwvault.ign.c....Detail&id=3837
http://nwvault.ign.c....Detail&id=3626

i'm always looking for new ideas and ways to combine mysql/web interfaces to interact with the game.  having a heartbeat poll the database every 6 seconds offers decent granularity to check for events to happen.
               
               

               


                     Modifié par acomputerdood, 19 juin 2012 - 05:00 .
                     
                  


            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Write to log?
« Reply #6 on: June 19, 2012, 07:38:29 pm »


               <marking up...>

Dood! I had no idea! Great stuff... and I *knew* you could export the minimap, somehow :-) Very important for my regional mod system ;-)

Seriously, a shameless self-promotion thread would not be inappropriate, I'm thinking. The web - ingame chat function alone is yummy enough for that :-)

<...bookmarks like crazy>