[Enhancement] - Write the logs into external log file.
It would be a great idea to write the logs into external file for those persons who want to catch some particular message and are not able due the terminal has a limit of lines to display. Or for those persons who runs the bot as background service with tmux or screen on his local or in a cloud server like digitalocean.
I use this command when running bot on my Raspberry Pi
run bot in background and create a log file named pogobot.log
nohup ./run.sh >pogobot.log &
run bot in background without creating log
nohup ./run.sh >/dev/null 2>&1 &
view log file
tail -f pogobot.log
Any idea what the windows commands for this would be? @emperium76
There are OS specific workarounds and seeing as you ignored the issue template which indicates what OS you're using it's hard to assist you with this. Going to mark it as a new feature to allow OS agnostic external logging
Please move your feature request/s to our feature hub - http://feathub.com/PokemonGoF/PokemonGo-Bot
Edit: Feathub may be turned off in favour of better GitHub tags, issue templates, and voting structures. Please feel free to continue using this issue (but don't delete the Feathub request just yet)
I modified run.sh to split output... unix specific though.
stamp=`date +%s`
python pokecli.py --config ${config} 2>&1 | tee logs/botlog-${stamp}.txt
here's what i did to mine:
#[ cli] pokecli.py line 62
handler = logging.FileHandler('bot_console.log')
handler.setFormatter(logging.Formatter('%(asctime)s [%(name)10s] [%(levelname)s] %(message)s'))
if not len(logger.handlers):
logger.addHandler(handler)
#[PokemonGoBot] pokemongo_bot/__init__.py line 73
#[IncubateEggs] pokemongo_bot/incubate_eggs.py line 18
#[PokemonCatchWorker] pokemongo_bot/pokemon_catch_worker.py line 44
import logging
...
self.logger = logging.getLogger(type(self).__name__)
handler = logging.FileHandler('bot_console.log')
handler.setFormatter(logging.Formatter('%(asctime)s [%(name)10s] [%(levelname)s] %(message)s'))
if not len(self.logger.handlers):
self.logger.addHandler(handler)
https://github.com/PokemonGoF/PokemonGo-Bot/issues/3843#issuecomment-239708680
#2729