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

[Feature] NodeJS Helper Library #39

Closed
4 tasks done
Tracked by #37
TanmoySG opened this issue May 11, 2022 · 17 comments · Fixed by #55
Closed
4 tasks done
Tracked by #37

[Feature] NodeJS Helper Library #39

TanmoySG opened this issue May 11, 2022 · 17 comments · Fixed by #55
Assignees
Labels
enhancement New feature or request feature Features Tag

Comments

@TanmoySG
Copy link
Owner

TanmoySG commented May 11, 2022

NodeJS Helper Library/Class for logsmith monitor. May publish a JS counterpart of logsmith - logsmithJS, as a logging library with support for monitor.

[Checkpoints]

  • Add Basic Console Logging
  • Add File Logging
  • Add monitor support
  • Add listener pickup from Env Variable

[Additional Details]

  • listeners are Address/Logsmith Monitor instances that listens to the logs
@TanmoySG TanmoySG added enhancement New feature or request feature Features Tag labels May 11, 2022
@TanmoySG TanmoySG self-assigned this May 11, 2022
TanmoySG added a commit that referenced this issue May 12, 2022
@TanmoySG
Copy link
Owner Author

@TanmoySG TanmoySG pinned this issue May 12, 2022
@TanmoySG
Copy link
Owner Author

"git - How to use actions/checkout@master to get sources into specified folder? - Stack Overflow" https://stackoverflow.com/questions/57914734/how-to-use-actions-checkoutmaster-to-get-sources-into-specified-folder

Can use this to checkout only the helper library and Publish it as a GH Package.

@TanmoySG
Copy link
Owner Author

How to Publish to NPM Registry

Login to npm

npm adduser

A prompt comes up, fill the details.

npm publish

Voila!

@TanmoySG
Copy link
Owner Author

TanmoySG commented May 12, 2022

How to go ahead with NodeJS Helper Library Publishing?

  • Will use NPM Registry rather than GH Registry
  • Will be using this repo for initial development.
  • With a initial feature ready build, will move the code to a separate repo - logsmith.js
  • Will Develop logsmith.js as a standalone logging library with support for monitor
  • Will publish/release on separate GH Repo

@TanmoySG
Copy link
Owner Author

[Publishing to GH Registry]
https://gist.github.com/silentHoo/8402d470ef48ef8979b8ecd3e5f206e3

@TanmoySG
Copy link
Owner Author

  • Published to GH Registry - has some issues if I try to install it locally
    image

  • Needs to set proxy and all that. Which is an added step just to get the package.

Will publish to NPM Registry - less steps to follow for end user.

TanmoySG added a commit that referenced this issue May 13, 2022
@TanmoySG
Copy link
Owner Author

TanmoySG added a commit that referenced this issue May 14, 2022
@TanmoySG
Copy link
Owner Author

TanmoySG commented May 14, 2022

Templating in JS

Using string-template for Templating. Link

Usage

Installing string-template

npm i string-template

Defining Templates can be done by putting the variable/placeholder name within { }

const template = "{level} : {log}"

Formatting the templates

import format from 'string-template';

const template = "[{level}] {body}"
log() {
        const logStatement = format(
            template,
             { 
                level:"test",
                body:  "testval"
              }
         )
        return logLevels.INFO(logStatement);
    }

Examples

Refer to these examples

@TanmoySG
Copy link
Owner Author

"Doing a cleanup action just before Node.js exits - Stack Overflow" https://stackoverflow.com/questions/14031763/doing-a-cleanup-action-just-before-node-js-exits

Save logs in file on exit only. Read Logs and write logs to Program Variables and not to file.

@TanmoySG
Copy link
Owner Author

TanmoySG added a commit that referenced this issue May 17, 2022
TanmoySG added a commit that referenced this issue May 19, 2022
TanmoySG added a commit that referenced this issue May 19, 2022
TanmoySG added a commit that referenced this issue May 22, 2022
TanmoySG added a commit that referenced this issue Jun 17, 2022
TanmoySG added a commit that referenced this issue Jun 17, 2022
TanmoySG added a commit that referenced this issue Jun 17, 2022
TanmoySG added a commit that referenced this issue Jun 17, 2022
TanmoySG added a commit that referenced this issue Jun 17, 2022
TanmoySG added a commit that referenced this issue Jun 17, 2022
TanmoySG added a commit that referenced this issue Jun 17, 2022
TanmoySG added a commit that referenced this issue Jun 17, 2022
TanmoySG added a commit that referenced this issue Jun 17, 2022
TanmoySG added a commit that referenced this issue Jun 17, 2022
TanmoySG added a commit that referenced this issue Jun 17, 2022
TanmoySG added a commit that referenced this issue Jun 17, 2022
TanmoySG added a commit that referenced this issue Jun 17, 2022
TanmoySG added a commit that referenced this issue Jun 17, 2022
TanmoySG added a commit that referenced this issue Jun 17, 2022
TanmoySG added a commit that referenced this issue Jun 17, 2022
TanmoySG added a commit that referenced this issue Jun 17, 2022
TanmoySG added a commit that referenced this issue Jun 17, 2022
TanmoySG added a commit that referenced this issue Jun 17, 2022
TanmoySG added a commit that referenced this issue Jun 17, 2022
TanmoySG added a commit that referenced this issue Jun 17, 2022
TanmoySG added a commit that referenced this issue Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature Features Tag
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant