Giter Club home page Giter Club logo

Comments (7)

dustdfg avatar dustdfg commented on May 25, 2024

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

from micro.

dustdfg avatar dustdfg commented on May 25, 2024

What error message do you get when it crash?

from micro.

Gavin-Holt avatar Gavin-Holt commented on May 25, 2024

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

from micro.

dustdfg avatar dustdfg commented on May 25, 2024

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:

func (h *BufPane) PluginCmd(args []string) {
if len(args) < 1 {
InfoBar.Error("Not enough arguments")
return
}
if h.Buf.Type != buffer.BTLog {
h.OpenLogBuf()
}
config.PluginCommand(buffer.LogBuf, args[0], args[1:])
}

When you print > plugin available internally micro opens logbuffer (which is io.Writer) and sends it to another function

func PluginCommand(out io.Writer, cmd string, args []string) {

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.

from micro.

dustdfg avatar dustdfg commented on May 25, 2024
-- How to detect if its already open ?
Current:OpenLogBuf()

I think no way to do it as we expected in just one line

func (h *BufPane) ToggleLogCmd(args []string) {
if h.Buf.Type != buffer.BTLog {
h.OpenLogBuf()
} else {
h.Quit()
}
}

> log don't check if log buffer is open it just checks if you ran it from log buffer.

  1. > log
  2. Ctrl+w to switch to non logbuf
  3. > 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

from micro.

dustdfg avatar dustdfg commented on May 25, 2024

// LogBufPane is a global log buffer.
var LogBufPane *BufPane

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 dustdfg@da2d4cf but I am not sure what to do with

// OpenLogBuf opens the log buffer from the current bufpane
// If the current bufpane is a log buffer nothing happens,
// otherwise the log buffer is opened in a horizontal split
func (h *BufPane) OpenLogBuf() {
LogBufPane = h.HSplitBuf(buffer.LogBuf)
LogBufPane.CursorEnd()
}

And I still don't know what causes problem of issues OP

from micro.

Gavin-Holt avatar Gavin-Holt commented on May 25, 2024

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.

from micro.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.