Catch log console messages

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
deb75
Prole
Posts: 38
Joined: Sun Apr 18, 2021 1:11 pm

Catch log console messages

Post by deb75 »

Hello,

On my project, I want to log some messages with the lualogging library using the console appender.

However, when I start the project like "love /path/to/project", the log messages do not appear anywhere.

How can i get the console messages, like those that would be printed with print("test") ?

Regards
MrFariator
Party member
Posts: 510
Joined: Wed Oct 05, 2016 11:53 am

Re: Catch log console messages

Post by MrFariator »

Sometimes, depending on OS or your code editor, you may have to turn off buffering for stdout to make any print() messages appear in console in real time.

Code: Select all

io.stdout:setvbuf("no")
Just put that line of code into conf.lua, or at the top of main.lua of your project. More information here.

Alternatively, on windows you may enable the console to appear via conf.lua (set t.console to true), or run your project with lovec.exe, as opposed to love.exe.
deb75
Prole
Posts: 38
Joined: Sun Apr 18, 2021 1:11 pm

Re: Catch log console messages

Post by deb75 »

Hi,

Thanks for your answeer.

On windows 10, I can see log messages on the console with lovec.exe. With love.exe, no matter what I do, log messages do not appear.

Trouble now is that I launch love from emacs with this function :

Code: Select all

(defun love/start ()
  "Run LÖVE externally for the sake of playtesting."
  (interactive)
  (if (buffer-live-p "*love*")
      (kill-buffer "*love*"))
  (start-process "löve" "*love*" love-exe (file-name-directory (buffer-file-name))))

and this function does not work with lovec.exe, I wonder why ?

What are the differences between love.exe and lovec.exe ?

Thanks for your help

Regards
User avatar
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

Re: Catch log console messages

Post by ReFreezed »

love.exe is compiled as a GUI program while lovec.exe is compiled as a console program - that's all. You really should be able to run lovec.exe if you can run love.exe.
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
User avatar
GVovkiv
Party member
Posts: 668
Joined: Fri Jan 15, 2021 7:29 am

Re: Catch log console messages

Post by GVovkiv »

ReFreezed wrote: Wed Jul 14, 2021 9:58 pm love.exe is compiled as a GUI program while lovec.exe is compiled as a console program - that's all. You really should be able to run lovec.exe if you can run love.exe.
Isn't lovec.exe it's just love, but with attached to it console?
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 65 guests