@@ -21,8 +21,6 @@ Simple pino-based logger for all your writing needs
2121
2222## How to use
2323
24- First step is to create a root logger. Its configuration can be specified on creation and it will be used for all other loggers created.
25-
2624### Import the logger factory
2725
2826``` js
@@ -35,15 +33,15 @@ or with import
3533import loggerFactory from ' cosmas' ;
3634```
3735
38- ### Create root logger with default configuration
36+ ### Create logger with default configuration
3937
4038``` js
4139const logger = loggerFactory; // factory itself is a logger
4240// or
4341const logger = loggerFactory ();
4442```
4543
46- ### Create root logger with custom configuration
44+ ### Create logger with custom configuration
4745
4846``` js
4947const logger = loggerFactory ({
@@ -52,18 +50,18 @@ const logger = loggerFactory({
5250});
5351```
5452
55- Note: If you want to specify custom configuration it must be done ** in the first require** of ` cosmas ` . Otherwise, default configuration will be used.
56-
5753See ** Options** for a list of possible options.
5854
59- After you create a root logger, you may use it or you can create a child logger.
55+ ### Child loggers
56+ Every logger can be used to create a * child* logger. Child logger inherits all configuration of its * parent* and cannot override them.
57+
58+ Child logger can specify its own * name* which is then concatenated with parent's * name* . Therefore the child logger name is ` parentNamechildName ` .
6059
6160``` js
62- const databaseLogger = loggerFactory (' database' )
61+ const parentLogger = loggerFactory (' database' , { pretty: false });
62+ const childLogger = parentLogger (' .updates' );
6363```
6464
65- The only difference between root logger and a child logger is that the child logger will print its name in each log message.
66-
6765## Logger usage
6866
6967Logger itself is an enhanced and specifically configured ` pino ` instance, so you may use all basic ` pino ` log methods
0 commit comments