Coder Social home page Coder Social logo

Comments (6)

nuest avatar nuest commented on June 12, 2024

A short update: it actually works with only DEBUGME=inspecter when setting it as an env var outside of R. Does this clarify anything?

DEBUGME=inspecter R -q -e 'library("inspecter"); inspecter::start()'
> library("inspecter"); inspecter::start()
onLoad: libname: /home/daniel/R/x86_64-pc-linux-gnu-library/3.4 environment: base
<environment: namespace:base>

Attaching package: ‘inspecter’

The following object is masked from ‘package:stats’:

    start

start: pkg: R_GlobalEnv
<environment: R_GlobalEnv>
inspecter starting...
inspecter initialize plumber with route definitions from /home/daniel/R/x86_64-pc-linux-gnu-library/3.4/inspecter/api.R +29ms
init: pkg: R_GlobalEnv
<environment: R_GlobalEnv>
inspecter run plumber +201ms
Starting server to listen on port 8091

from debugme.

gaborcsardi avatar gaborcsardi commented on June 12, 2024

Debugging is turned on/off when you load your package. So setting the env var after loading it, will not change anything.

from debugme.

nuest avatar nuest commented on June 12, 2024

Sorry, I don't know what changed, I failed to re-test the combinations of values for DEBUGME:

> Sys.setenv(DEBUGME = "inspecter")
> library(inspecter)
onLoad: libname: /home/daniel/R/x86_64-pc-linux-gnu-library/3.4 environment: base 
<environment: namespace:base>

Attaching package: ‘inspecter’

The following object is masked from ‘package:stats’:

    start

> inspecter::start()
start: pkg: R_GlobalEnv 
<environment: R_GlobalEnv>
inspecter starting... 
inspecter initialize plumber with route definitions from /home/daniel/R/x86_64-pc-linux-gnu-library/3.4/inspecter/api.R +35ms 
inspecter run plumber +275ms 
Starting server to listen on port 8091
Running the swagger UI at http://127.0.0.1:8091/__swagger__/

from debugme.

nuest avatar nuest commented on June 12, 2024

Apologies for the back and forth. The problem remains for logs from the file inst/api.R.

@trestletech can you shed light on how plumber::plumb(file = "inst/api.R") loads the file, i.e. what environment it should be in?

from debugme.

trestletech avatar trestletech commented on June 12, 2024

The runtime and environments for plumber are documented here: https://www.rplumber.io/docs/runtime.html

from debugme.

nuest avatar nuest commented on June 12, 2024

@trestletech Thanks, that helps. So I could define my routers programmatically instead of using annotations and then set my own environment. This line also explains why logging works when I enable it for the the environment R_GlobalEnv,base. I tried to fix this by creating a new environment with my package environment as parent and initiating my router with it, but that did not work.

Eventually I switched from annotations to defining my endpoints with pr$handle().

Hope this helps other people logging plumber with debugme.

from debugme.

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.