Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add running and debugging pages #5335

Merged
merged 1 commit into from
May 6, 2020
Merged

docs: add running and debugging pages #5335

merged 1 commit into from
May 6, 2020

Conversation

agnes512
Copy link
Contributor

@agnes512 agnes512 commented May 5, 2020

Implements #4845

Include Most of the bug strings

Screen Shot 2020-05-05 at 1 49 58 PM

Screen Shot 2020-05-05 at 1 49 33 PM

Screen Shot 2020-05-05 at 4 16 01 PM

Screen Shot 2020-05-05 at 4 16 19 PM

Screen Shot 2020-05-05 at 4 16 31 PM

Checklist

👉 Read and sign the CLA (Contributor License Agreement) 👈

  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Documentation in /docs/site was updated
  • Affected artifact templates in packages/cli were updated
  • Affected example projects in examples/* were updated

👉 Check out how to submit a PR 👈


## Debug strings reference

<table>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you create this table by hand? Can we automate this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if we have any script to do it, so I checked modules one by one 😳 And I didn't include all of the debug strings in here, or the list would be extremely long... I only include those important (from my understanding) ones. Any suggestions?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A shell script will do. Or monkey patch the debug function :-)

Copy link
Contributor

@emonddr emonddr May 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@agnes512 ,

Here's a script I just made:

#!/bin/bash 
clear
FILE_EXTENSION=$1
SEARCH_TEXT=$2
echo ""
echo " Files with extension : '${FILE_EXTENSION}'  "
echo " that contains text   : '${SEARCH_TEXT}' : "
echo "----------------------------------------------"
echo ""
find . -name "${FILE_EXTENSION}" -exec grep -h "${SEARCH_TEXT}" {} +
echo ""
echo ""




# include file name and found search text
# find . -name "*.ts" -exec grep "debugFactory('loopback" {} +

# only show found search text
# find . -name "*.ts" -exec grep -h "debugFactory('loopback" {} +

Call

./find_files_with_text.sh "*.ts" "'loopback:"

If you want to see : filename searchText in the results, remove the -h in the script.
Right now it outputs ONLY the found search text : searchText

Based on my search string above, I found:

 Files with extension : '*.ts'  
 that contains text   : ''loopback:' : 
----------------------------------------------

const debug = require('debug')('loopback:benchmark');
const debug = debugFactory('loopback:cron');
const debug = debugFactory('loopback:multi-tenancy:strategy:query');
const debug = debugFactory('loopback:multi-tenancy:strategy:header');
const debug = debugFactory('loopback:multi-tenancy:strategy:host');
const debug = debugFactory('loopback:multi-tenancy:strategy:jwt');
const debug = debugFactory('loopback:multi-tenancy:action');
const debug = require('debug')('loopback:example:acl');
const debug = debugFactory('loopback:boot:lb3app');
const debug = debugFactory('loopback:repository:belongs-to-accessor');
const debug = debugFactory('loopback:repository:belongs-to-helpers');
const debug = debugFactory('loopback:repository:has-one-helpers');
const debug = debugFactory('loopback:repository:has-one-repository-factory');
const debug = debugFactory('loopback:repository:has-many-repository-factory');
const debug = debugFactory('loopback:repository:has-many-inclusion-resolver');
const debug = debugFactory('loopback:repository:has-many-helpers');
const debug = debugFactory('loopback:repository:relation-helpers');
export const RELATIONS_KEY = 'loopback:relations';
const debug = debugFactory('loopback:repository:mixin');
>('loopback:model');
>('loopback:model-properties');
>('loopback:model-and-properties');
const debug = debugFactory('loopback:context:binding');
const debug = debugFactory('loopback:context:invocation');
const debug = debugFactory('loopback:context:interceptor');
const debug = debugModule('loopback:context:resolver');
const debug = debugFactory('loopback:context:binding-inspector');
   * const debug = debugFactory('loopback:context:application');
   *   return 'loopback:context:application';
    if (this.constructor === Context) return 'loopback:context';
const debug = debugFactory('loopback:context:subscription');
      expect(myCtx.debugFn.namespace).to.eql('loopback:context:mycontext');
const debug = debugModule('loopback:context:test');
const debug = debugFactory('loopback:context:interceptor-chain');
const debugSession = debugModule('loopback:context:resolver:session');
const debug = debugFactory('loopback:context:view');
const debug = debugFactory('loopback:core:lifecycle');
const debug = debugFactory('loopback:core:application');
const debugShutdown = debugFactory('loopback:core:application:shutdown');
const debugWarning = debugFactory('loopback:core:application:warning');
const debug = debugFactory('loopback:boot:booter-utils');
const debug = debugFactory('loopback:boot:base-artifact-booter');
const debug = debugFactory('loopback:boot:lifecycle-observer-booter');
const debug = debugFactory('loopback:boot:interceptor-booter');
const debug = debugFactory('loopback:boot:service-booter');
const debug = debugModule('loopback:boot:booter:application-metadata');
const debug = debugFactory('loopback:boot:model-api');
const debug = debugModule('loopback:boot:bootstrapper');
const debug = debugFactory('loopback:http-caching-proxy');
const debug = debugFactory('loopback:tsdocs');
const debug = debugFactory('loopback:tsdocs');
>('loopback:json-schema');
const debug = debugFactory('loopback:repository-json-schema:build-schema');
  'loopback:openapi3:metadata:controller-spec:deprecated',
const debug = require('debug')('loopback:openapi3:metadata:requestbody');
const debug = debugModule('loopback:openapi:spec-enhancer');
const debug = debugModule('loopback:openapi:spec-enhancer');
const debug = debugModule('loopback:openapi:spec-enhancer');
const debug = require('debug')('loopback:openapi3:metadata:controller-spec');
const debug = debugFactory('loopback:repository-tests');
const debug = debugFactory('loopback:authorization:interceptor');
const debug = debugModule('loopback:metadata:decorator');
const debug = debugFactory('loopback:boot:crud-rest');
const debug = debugFactory('loopback:openapi:spec-enhancer:consolidate');
const debug = debugFactory('loopback:openapi:spec-enhancer:info');
const debug = debugModule('loopback:rest:body-parser');
const debug = debugModule('loopback:rest:body-parser');
const debug = debugFactory('loopback:rest:parser');
const debug = debugFactory('loopback:openapi:spec-enhancer');
const debug = require('debug')('loopback:rest:sequence');
const debug = debugFactory('loopback:rest:server');
const debug = debugModule('loopback:rest:coercion');
const debug = debugModule('loopback:rest:coercion');
const debug = debugModule('loopback:rest:ajv');
const debug = debugModule('loopback:rest:validation');
const debug = require('debug')('loopback:rest:router:trie');
const debug = debugFactory('loopback:rest:routing-table');
const debug = require('debug')('loopback:rest:router:regexp');
const debug = debugFactory('loopback:rest:controller-route');

but feel free to adjust the search string

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!! I also found that some packages have different ways to define the string e.g @loopback:cli 😂 which I have no idea how to write a script for


```
$ cd myapp
$ node .
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not npm start?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to add API Connect here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think so.

docs/site/Setting-debug-strings.md Outdated Show resolved Hide resolved
@agnes512 agnes512 force-pushed the debug branch 3 times, most recently from 7210a99 to 5698f41 Compare May 5, 2020 20:34
@agnes512 agnes512 marked this pull request as ready for review May 5, 2020 20:46
Copy link
Member

@dhmlau dhmlau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to be consistent to use npm start instead. Other that that, the changes LGTM. Thanks!

docs/site/Running-debugging-apps.md Outdated Show resolved Hide resolved
docs/site/Setting-debug-strings.md Outdated Show resolved Hide resolved
Copy link
Contributor

@jannyHou jannyHou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


## Using debug strings

LoopBack has a number of built-in debug strings to help with debugging.Specify a
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LoopBack has a number of built-in debug strings to help with debugging.Specify a
LoopBack has a number of built-in debug strings to help with debugging. Specify a

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, will fix it in #4846

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants