Search
  • Russ Watson

Class logging with decorators


Bakerstreet has open sourced one of its logging utilities, ts-log-class, and has made it available on NPM.

ts-log-class is a helper utility that will add log output for all methods of a class by adding a @log decorator to the class definition. Stop adding console.log or other logging strategies within each method, but have it done for you.

The default log function takes a set of properties and forms them into a message using JSON.stringify and uses console.log for the message.

Overrides for the function to format the set of properties and the default out methods are provided.

Usage examples can be found in the README and within the tests.

#developers #typescript #logger #decorators #ES2017

55 views

Recent Posts

See All

We are hiring!

Software Engineer (All levels) Do you like working with bleeding edge technologies? Do you view yourself as a best-in-class developer? Do you enjoy defining and contributing to a set of best practices

214-235-4413

675 Town Square Blvd., Suite 200
Garland, Texas, 75040

©2020 BAKERSTREET INDUSTRIES