Giter Site home page Giter Site logo

Feature request: custom logger about pocketbase HOT 4 CLOSED

Gys avatar Gys commented on May 25, 2024
Feature request: custom logger

from pocketbase.

Comments (4)

ganigeorgiev avatar ganigeorgiev commented on May 25, 2024

There are no plans to make the default app logger customizable but with the refactoring there will be dedicated hooks that will allow listening to the individual log writes.

To some extend you can do that already with something like:

app.OnAfterBootstrap().Add(func(e *core.BootstrapEvent) error {
	app.LogsDao().BeforeCreateFunc = func(eventDao *daos.Dao, m models.Model, action func() error) error {
		if log, ok := m.(*models.Log); ok {
			// do something with the log model...
			fmt.Println(log)
		}
		return action() // proceed with the normal operation
	}

	return nil
})

from pocketbase.

Gys avatar Gys commented on May 25, 2024

Thank you for the very fast reply!

From a first quick test this seems to only works for requests? Not for debug? Maybe also not for error or warning messages? Maybe I can set a level somewhere else?

from pocketbase.

ganigeorgiev avatar ganigeorgiev commented on May 25, 2024

You can control the min log level from the Admin UI > Logs > Logs settings popup.

from pocketbase.

Gys avatar Gys commented on May 25, 2024

Aha, did not know that one. Thanks!

from pocketbase.

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.