Closed Gavin-Holt closed 7 months ago
I don't have time just right now to answer but you can use micro.Log(err)
. It will output to log.txt
file although you will need to run micro with micro -debug
What error message do you get when it crash?
Hi
Many thanks for your reply.
I want to use the LogBuf in the same way the plugin available
command displays output.
I think the Log.txt is a different beast, for debugging the application.
I don't get an error message the console dies and disappears (It may be because I am running a batch file to launch Micro).
Kind Regards Gavin Holt
I think the Log.txt is a different beast, for debugging the application.
Yeah
I don't get an error message the console dies and disappears (It may be because I am running a batch file to launch Micro).
Maybe try to open not with batch file? It usually say when error in plugin and what is an error. Idk if it will help but know what it prints wouldn't be bad
want to use the LogBuf in the same way the plugin available command displays output.
Ok. What I found:
When you print > plugin available
internally micro opens logbuffer (which is io.Writer
) and sends it to another function
that prints to buffer via fmt.Fprintln(out, <text>)
P.S it won't help with WriteLog
but you can write there as you wanted.
-- How to detect if its already open ?
Current:OpenLogBuf()
I think no way to do it as we expected in just one line
> log
don't check if log buffer is open it just checks if you ran it from log buffer.
> log
Ctrl+w
to switch to non logbuf> log
You will see two bufpanes with the same content. But if you run > log
from log buf, it will just close it. If you want to check if log buf is currently opened you will need to iterate thorough all the panes and check if one of them is log buf. Idk I will try to do more research
It looks like a sorta bug. We have only one pointer for global LogBufPane
so we must have only one log pane at the moment. But in previous comment I said how to do it. Am I right it is a bug? @dmaluka @JoeKar
Does comment rely on the fact it is opened only by ToggleLogCmd
?
It is easy to correct for > log
https://github.com/dustdfg/micro/commit/da2d4cf56d92a7fd51da5aed569a931a4b1bb2d0 but I am not sure what to do with
And I still don't know what causes problem of issues OP
Hi
I have been silly. Reading the Plugins.md I found the bufffer.Log
function!
So to write to the global LogBuf is literally:
buffer.Log("Hello World")
.
However, be sure to use tostring()
beforehand as there is no built in type conversion:
buffer.Log(8) -- Fails
Kind Regards Gavin Holt
I will leave the problem of multiple Log splits for brighter minds.
Hi,
Sorry to be an idiot, I have looked and looked at the available documentation - does anyone know how to use WriteLog from Lua?
I have tried the obvious options:
All crash micro! This is a similar problem to the unanswered https://github.com/zyedidia/micro/issues/1191 from Sep 22, 2018.
I want to use the LogBuf to capture output from Lua (the terminal is not easy to copy from):
I am also struggling to detect an open LogBuf, at present my function adds a new split on each invocation.
Accessing the Go libraries within micro (from Lua) is going to be the super-power of this editor, once I grok how to call the functions. Do I need a LLM to process the Micro source + Pkg Dev help files and synthesize a list of callable Lua functions? Or is there a simpler solution using awk.exe?
Sorry if I sound frustrated, but Micro is so good I am working hard to make it my only editor - init.lua.txt
Kind Regards Gavin Holt
OS: Windows 10 Version: 2.0.13 Commit hash: https://github.com/zyedidia/micro/commit/68d88b571de6dca9fb8f03e2a3caafa2287c38d4 Compiled on December 12, 2023