diff --git a/LICENSE b/LICENSE index f436199..bb46ed3 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 Second Bounce Ltd +Copyright (c) 2023-24 Second Bounce Ltd Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index c8db01d..c7bd76b 100644 --- a/README.md +++ b/README.md @@ -6,37 +6,32 @@ log4ngx is a Typescript logging framework for Angular projects, based on concepts used in Log4j, Log4net, etc. -> **Current Status** -> The library is now complete enough to be used in production if the `ConsoleAppender` and -`LocalStorageAppender` are sufficient for your needs. Documentation is being completed in the -repository and will be updated as progress is made - as soon as it is in a reasonably complete -state, a proper link will be made available here. -> -> Until then, the [demo project](tree/main/projects/demo/) contains examples of configuring and -using the library. - ## Concepts +### Loggers + +`Loggers` provide access to the methods for logging messages at the required `Level`. Each class - +i.e. component, module or service - will usually define its own `Logger` which will identify that +class within any messages logged via it. + ### LogService The `LogService` is the factory with which you instantiate `Loggers` in each of the components, services, etc, in which you wish to log messages. Behind the scenes, it also orchestrates the dispatch of messages from the `Loggers` to the appropriate `Appenders`. +### Appenders + +`Appenders` are responsible for sending log entries to the underlying target or service. +Configuration will normally depend on the target/service, but all `Appenders` are configured with +the layout format for messages logged to them. + ### LogServiceConfig The `LogService` is configured using an instance of the `LogServiceConfig`, typically created in your application's main module. The configuration defines the parameters used with each `Appender` and how each `Appender` relates to the various `Loggers`. -### Loggers - -`Loggers` provide access to the methods for logging messages at the required `Level`. Each class - -i.e. component, module or service - will usually define its own `Logger` which will identify that -class within any messages logged via it. - -### Appenders - -`Appenders` are responsible for sending log entries to the underlying target or service. -Configuration will normally depend on the target/service, but all `Appenders` are configured with -the layout format for messages logged to them. +For more information about using and configuring log4ngx, see . +The [demo project](projects/demo/) also contains examples of configuring and using the +library. diff --git a/docs/assets/navigation.js b/docs/assets/navigation.js index 74732f0..a74e408 100644 --- a/docs/assets/navigation.js +++ b/docs/assets/navigation.js @@ -1 +1 @@ -window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAACpWU0W6CMBSGX2XpNZubboZ4ZxgjZk6MmN0YQyoca7NaSCnGZPHdl6mIsNp213zn+09PT1l8Iwl7iQYoACkpJ3eRxEJCihyUY7lBA5RmSbkFLovOGYnPyMNGbhly0BflKRq4PdftP7oH52L0Mr6mpBRY0oyrfA3AZMvLFaPJPc5prdpmacmg6Jy+xTinTUvXQcmGslQAR4PFRTXMc+ApiCnDCWwyloIoainwcttQqvBWt1d9VnQtTBguClAqm5qnbmt8RcbAytdiLbQRiB1NwMZ6RnXSMeyAaV1HQqvIEswimQlM7M6sKtAHkGdO9h/HnTGYr0iD0maONWaQEeORfxGThHLi74BLo6oCdcJqsqe3WisplyDWOFHv9YluPcaX/u3tttMri3Qpqh2xi7pdqc+rbto2pckb3MS++5rV3kI4icKxHw+nU3/y6s/iefjuT2r7DguKV61frLqoGdPrXnceesNxNA9nw+CfUZpKbV4QR/7sc+T5sRdO3kaBZZi67E/S8rD8AdzRb5o4BwAA" \ No newline at end of file +window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAACpWU0WqDMBSGX2Xk2q1by4p4J85JWdFSy25KkVRPNSwmEqMMRt99bK21ujS6a7/z/T85idsvJOFTIgt5ICVh6V0osZCQIAMVWGbIQgmPqxyYLCdnJDojD5nMKTLQB2EJssyZac4fzaNxMTqcHUhaCSwJZypfBxiyFdWekvgeF6RV5TypKJST07cIF6RrmRoozghNBDBkbS8quyiAJSBWFMeQcZqAKFspsCrvKFV4r+1Vz4ZuhTHFZQlKZVfzNO0dX8kpjPL1WJ12CTVQreyX0Cp4jGkoucDpuHqqAX1AGoKoSQwD2gYbkKWD/X6QIQlhqVsDk4OqBtQJm2M4vYFWSZgEccCx+r6c6N4lf57fvjXj9MohXYpqoeOibk/q85pNj03p8gPudHz7ltVuIfDDYOlG9mrl+i/uOtoEb67f2mssCN73fl3qoW7MbHrdPHDsZbgJ1rb3zyjNpDbPi0J3/b5w3MgJ/NeFNzJMPfYnaXfcfQOoYWhfkAYAAA==" \ No newline at end of file diff --git a/docs/assets/search.js b/docs/assets/search.js index 07bbae1..584d455 100644 --- a/docs/assets/search.js +++ b/docs/assets/search.js @@ -1 +1 @@ -window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAACr2dXW/buBKG/8qBcuvNih+ipNwVbbYottsuNj17ExSB1lZco/4IbCXbnqD//YASZc2QQ4uS1VyljTUzL6WHw9HQUp6j/e7fQ3R1+xx9XW0X0VUmskzF2SzaFpsyuorellW12i7/c1MV+6pcRLPocb+OrqLFbv64KbfV4VdzxJ054vJLtVlHs2i+Lg6H8hBdRdGPmc/76932frV83BfVarclfKPPT3rmR58Pj/+sV/NfiofV0eFmt3hcl4dfm4/uiofVSV+MdwpfPTyU20W5P/oyFtBXewzhdBY9FPtyW2FdXaiEdcLnu+2h2j/Oq114tAts1Bf5aAzPXCy74Rb159dP2jBYAzbqNFSHxS+rwy8P+11Vzht4xmhabVfVqliv/leGS0I2o86K4kzKo4b6R3B0c/QEcde75W+7/aYYcDWgyQQKyv1+tx+qARtNROVQIKeIvK8/fb9bLlfb5cBpQdpOPjuaKNf6hA+V1hpNocnNmH+ui3n5ZbdelPvDUVm5fdyQuuDRI/IoU8f478uncj0i4EVrGAwNGiGtZbdcgrVjiJjWckI1f5SHQ7Esx8jpTCfU82m1KQ9VsXkYowgaT6jpTVGNOkHGbkIl7w67sWI60wn13HzZ7auxiqDxxFerWm1GXzFjOzHTY3GeVsl/q/nYq9WZTqgHL1ED1LjL1DRaPhTjLhU0nlrTGSnasp9a2U1VzL+O1tVaT6jq9X59P0aPsZtylR+l4/0UKniinMKruWk+Slptq3J/X8zperA5eEzFFXPP7VFwwMH3SWZkHhEP+93TalHuP+2+ltsRamz7iWS5t3Dhkkbdy52WQ93PhQsaeWPnSuKoCXTYrcuQTot16Ms0XKigQ/su9hjPanWQgoZ1PAL1BLaDSEFndoVOKBzWmiHFOZnHqFptv5T71QSqgho3pD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tvIb0GXzg6cAPqCF+WlZHn5RFrgRoEt+FJvnRUFvwJqKYjPUqZ+vw0PMYD5Bz1K/yG1+tKCxgsLAKlB+S8s8KQMGCODFDU+R+dQ5pgHKbxIb7w/mFRQQeWFQMgibJqRBNzJbWizaz2RAg4fnj0CvQNDhfquvcdUfYQ5A5gMk7dvfWwWOUuAo9nJknnUFyxN0KhLdFPntZKu8No+sAXzA2oj8eNZuzKP0IMKDvqXecvQ/WgK9gFXhF73ah6xBd4CHqIuEoa+v41v/R49gvI0/YZa/8huuYl+SuAbWAvPz8jX/vjOvf4LeQnFGXeznj4DAQAxgXQxg3QjGXQzwizC9LQV0l3vK0y+i7dsX0U6kABHwHPutKOjZlgdIMA7KD2SbS5oMRCCViv02s+a5c7BpoPTfb9dYl6v7fftazH2ryTKKoMuJ7/yscv167/L4ei8YQhALlCEn8VuD63Jl2TrAoja5sTChT3anILOlxGazSrxHpxfHGAj2zCTkqV/Qb53RiVcCTtsQX/2dSEno6ZDo+VJq3ncEEw/8Jb7Lp3l4lhxjFAwfoTdE++6FQCAKzEDqTY1xZFl2YPQTvyxgk31bNq+DAy8AQWUYTPxSSUtmwkDcZodp9EO2zwRYa2apCRO1hVkTstuvzN9j85mYtZL6zXzzU30gqMODq9+u0L0QTk9yYI6EUSW7Ufaju32+GzkdWm9pf0mDJMcMLrpOnNkgYz+gWs+upcNgfDBzI018i/3CxV7/0x4kywDbBfdbSPvuX5gD6oamZOT0BQtffjMBXu4AQgDp7JCP+K3Bx3pBRgecm7gfY0/tD+SBjQ50TfmNTvuOHqAU9CqKunTLo1efZ8Gu2OXrYpsHN/PPP378H0D0fnJHcAAA"; \ No newline at end of file diff --git a/docs/classes/public_api.Appender.html b/docs/classes/public_api.Appender.html index 0d5e851..f35768e 100644 --- a/docs/classes/public_api.Appender.html +++ b/docs/classes/public_api.Appender.html @@ -1,4 +1,4 @@ -Appender | log4ngx

Class AppenderAbstract

Hierarchy (view full)

Constructors

constructor +Appender | log4ngx

Class AppenderAbstract

Hierarchy (view full)

Constructors

Accessors

Methods

+

Constructors

Accessors

Methods

diff --git a/docs/classes/public_api.ConsoleAppender.html b/docs/classes/public_api.ConsoleAppender.html index e0cb18a..ea8e729 100644 --- a/docs/classes/public_api.ConsoleAppender.html +++ b/docs/classes/public_api.ConsoleAppender.html @@ -1,4 +1,4 @@ -ConsoleAppender | log4ngx

Hierarchy (view full)

Constructors

constructor +ConsoleAppender | log4ngx

Hierarchy (view full)

Constructors

Accessors

Methods

+

Constructors

Accessors

Methods

diff --git a/docs/classes/public_api.Level.html b/docs/classes/public_api.Level.html index 0fda15c..cc671be 100644 --- a/docs/classes/public_api.Level.html +++ b/docs/classes/public_api.Level.html @@ -1,4 +1,4 @@ -Level | log4ngx

Properties

name +Level | log4ngx

Properties

name value debug error @@ -9,4 +9,4 @@

Accessors

Methods

Properties

name: string
value: number
debug: Level = ...
error: Level = ...
fatal: Level = ...
info: Level = ...
off: Level = ...
warn: Level = ...

Accessors

  • get displayName(): string
  • Returns string

  • set displayName(displayName): void
  • Parameters

    • displayName: string

    Returns void

Methods

  • Parameters

    • value: number
    • name: string
    • displayName: string

    Returns Level

+

Properties

name: string
value: number
debug: Level = ...
error: Level = ...
fatal: Level = ...
info: Level = ...
off: Level = ...
warn: Level = ...

Accessors

  • get displayName(): string
  • Returns string

  • set displayName(displayName): void
  • Parameters

    • displayName: string

    Returns void

Methods

  • Parameters

    • value: number
    • name: string
    • displayName: string

    Returns Level

diff --git a/docs/classes/public_api.LocalStorageAppender.html b/docs/classes/public_api.LocalStorageAppender.html index 4b43e04..ec14788 100644 --- a/docs/classes/public_api.LocalStorageAppender.html +++ b/docs/classes/public_api.LocalStorageAppender.html @@ -7,7 +7,7 @@ To access other days' logs, check for localStorage values whose key starts with keyPrefix.

maxDays controls the maximum number of days for which log entries are retained. Once this is reached, the oldest day's logs will be deleted.

-

Hierarchy (view full)

Constructors

Hierarchy (view full)

Constructors

Accessors

Methods

+

Returns string

Methods

diff --git a/docs/classes/public_api.LogService.html b/docs/classes/public_api.LogService.html index d6f8f0a..e3e6e0f 100644 --- a/docs/classes/public_api.LogService.html +++ b/docs/classes/public_api.LogService.html @@ -1,7 +1,10 @@ LogService | log4ngx
export class MyComponent {
private readonly _log: Logger;

constructor(logService: LogService) {
this._log = logService.getLogger(this);
}
}
-

Constructors

Methods

Constructors

Methods

Constructors

Methods

+

Constructors

Methods

  • Parameters

    • name: string

    Returns Logger

  • Parameters

    • instance: object

      IMPORTANT This overload should not be used if your build system minifies or otherwise mangles +class names and you intend including the class name in your log output.

      +

    Returns Logger

diff --git a/docs/classes/public_api.Logger.html b/docs/classes/public_api.Logger.html index 0b87ee4..867d616 100644 --- a/docs/classes/public_api.Logger.html +++ b/docs/classes/public_api.Logger.html @@ -1,7 +1,7 @@ Logger | log4ngx

The Logger class provides access to the methods for logging messages at the required Level.

Typically, each component or service will instantiate its own Logger instance, which will include the logger's Logger.name in the logged message.

-

Constructors

Constructors

Properties

Methods

assert debug @@ -14,94 +14,94 @@

Logger instances should NOT be instantiated directly using this constructor as the instance will not be registered and cached within the LogService. (This will mean that every instance of the parent class will end up with its own duplicate copy, rather than sharing a single instance.) -Instead, use the LogService.getLogger, i.e.

+Instead, use the LogService.getLogger() method, i.e.

   this._log = logService.getLogger('MyComponent');
 
-

Parameters

Returns Logger

Properties

name: string

A name, usually that of the 'parent' component, that will be logged with each message.

-

Methods

Properties

name: string

A name, usually that of the 'parent' component, that will be logged with each message.

+

Methods

  • Logs the message if condition is false.

    The log entry is recorded as Level.error.

    Parameters

    • condition: undefined | boolean

      A boolean value or statement that determines if the message is logged or not.

    • message: string

      The text message to be logged.

      -

    Returns void

  • Logs the message if condition is false.

    +

Returns void

  • Logs the message if condition is false.

    The log entry is recorded as Level.error.

    Parameters

    • condition: undefined | boolean

      A boolean value or statement that determines if the message is logged or not.

    • error: Error

      An Error object to be logged.

      -

    Returns void

  • Logs the message if condition is false.

    +
  • Returns void

  • Logs the message if condition is false.

    The log entry is recorded as Level.error.

    Parameters

    • condition: undefined | boolean

      A boolean value or statement that determines if the message is logged or not.

    • message: string

      The text message to be logged.

    • error: Error

      An Error object to be logged.

      -

    Returns void

  • Logs the message if condition is false.

    +
  • Returns void

  • Logs the message if condition is false.

    The log entry is recorded as Level.error.

    Parameters

    • condition: undefined | boolean

      A boolean value or statement that determines if the message is logged or not.

    • message: string
    • data: object

      An object to be logged.

      -

    Returns void

  • Returns void

    Returns void

  • Logs the message as Level.debug.

    Parameters

    • error: Error

      An Error object to be logged.

      -

    Returns void

  • Logs the message as Level.debug.

    +
  • Returns void

  • Logs the message as Level.debug.

    Parameters

    • message: string

      The text message to be logged.

    • error: Error

      An Error object to be logged.

      -

    Returns void

  • Logs the message as Level.debug.

    +
  • Returns void

  • Logs the message as Level.debug.

    Parameters

    • message: string

      The text message to be logged.

    • data: object

      An object to be logged.

      -

    Returns void

  • Returns void

    Returns void

  • Logs the message as Level.error.

    Parameters

    • error: Error

      An Error object to be logged.

      -

    Returns void

  • Logs the message as Level.error.

    +
  • Returns void

  • Logs the message as Level.error.

    Parameters

    • message: string

      The text message to be logged.

    • error: Error

      An Error object to be logged.

      -

    Returns void

  • Logs the message as Level.error.

    +
  • Returns void

  • Logs the message as Level.error.

    Parameters

    • message: string

      The text message to be logged.

    • data: object

      An object to be logged.

      -

    Returns void

  • Returns void

    Returns void

  • Logs the message as Level.fatal.

    Parameters

    • error: Error

      An Error object to be logged.

      -

    Returns void

  • Logs the message as Level.fatal.

    +
  • Returns void

  • Logs the message as Level.fatal.

    Parameters

    • message: string

      The text message to be logged.

    • error: Error

      An Error object to be logged.

      -

    Returns void

  • Logs the message as Level.fatal.

    +
  • Returns void

  • Logs the message as Level.fatal.

    Parameters

    • message: string

      The text message to be logged.

    • data: object

      An object to be logged.

      -

    Returns void

  • Returns void

    Returns void

  • Logs the message as Level.info.

    Parameters

    • error: Error

      An Error object to be logged.

      -

    Returns void

  • Logs the message as Level.info.

    +
  • Returns void

  • Logs the message as Level.info.

    Parameters

    • message: string

      The text message to be logged.

    • error: Error

      An Error object to be logged.

      -

    Returns void

  • Logs the message as Level.info.

    +
  • Returns void

  • Logs the message as Level.info.

    Parameters

    • message: string

      The text message to be logged.

    • data: object

      An object to be logged.

      -

    Returns void

  • Returns void

    Returns void

  • Logs the message as the specified level.

    Parameters

    • levelName: string

      The name of the level.

    • error: Error

      An Error object to be logged.

      If no Level has been defined for the specified levelName, the message will be ignored.

      -

    Returns void

  • Logs the message as the specified level.

    +
  • Returns void

  • Logs the message as the specified level.

    Parameters

    • levelName: string

      The name of the level.

    • message: string

      The text message to be logged.

    • error: Error

      An Error object to be logged.

      If no Level has been defined for the specified levelName, the message will be ignored.

      -

    Returns void

  • Logs the message as the specified level.

    +
  • Returns void

  • Logs the message as the specified level.

    Parameters

    • levelName: string

      The name of the level.

    • message: string

      The text message to be logged.

    • data: object

      An object to be logged.

      If no Level has been defined for the specified levelName, the message will be ignored.

      -

    Returns void

  • Returns void

    Returns void

  • Logs the message as Level.warn.

    Parameters

    • error: Error

      An Error object to be logged.

      -

    Returns void

  • Logs the message as Level.warn.

    +
  • Returns void

  • Logs the message as Level.warn.

    Parameters

    • message: string

      The text message to be logged.

    • error: Error

      An Error object to be logged.

      -

    Returns void

  • Logs the message as Level.warn.

    +
  • Returns void

  • Logs the message as Level.warn.

    Parameters

    • message: string

      The text message to be logged.

    • data: object

      An object to be logged.

      -

    Returns void

  • +

    Returns void

    diff --git a/docs/classes/public_api.LoggingEvent.html b/docs/classes/public_api.LoggingEvent.html index 9d504b0..1baca33 100644 --- a/docs/classes/public_api.LoggingEvent.html +++ b/docs/classes/public_api.LoggingEvent.html @@ -1,7 +1,7 @@ -LoggingEvent | log4ngx

    Constructors

    constructor +LoggingEvent | log4ngx

    Constructors

    Properties

    error?: Error
    level: Level
    loggerName: string
    message: string
    timestamp: number = ...
    +

    Constructors

    Properties

    error?: Error
    level: Level
    loggerName: string
    message: string
    timestamp: number = ...
    diff --git a/docs/coverage.svg b/docs/coverage.svg index dd03396..faf7f69 100644 --- a/docs/coverage.svg +++ b/docs/coverage.svg @@ -11,7 +11,7 @@ docs % docs % - 57% - 57% + 60% + 60% \ No newline at end of file diff --git a/docs/documents/Configuration.html b/docs/documents/Configuration.html index b0220c9..a86ad28 100644 --- a/docs/documents/Configuration.html +++ b/docs/documents/Configuration.html @@ -1,5 +1,5 @@ Configuration | log4ngx

    Configuration

    The configuration is defined using the LogServiceConfig interface. This can be done directly within main.ts and passed into the providers:

    -
    const loggingConfig: LogServiceConfig = {
    loggers: [
    {
    loggerName: '',
    level: 'warn',
    appenderNames: [
    'console'
    ]
    }
    ],
    appenders: [
    {
    name: 'console',
    providerToken: CONSOLE_APPENDER_TOKEN,
    logFormat: `[${AppenderPlaceholders.Level}] ${AppenderPlaceholders.Logger} ${AppenderPlaceholders.Message}${AppenderPlaceholders.Error}`
    }
    ]
    };

    const appConfig = {
    providers: [
    ...
    importProvidersFrom(Log4ngxModule),
    { provide: CONSOLE_APPENDER_TOKEN, useClass: ConsoleAppender },
    { provide: LOG_SERVICE_CONFIG_TOKEN, useValue: loggingConfig }
    ]
    };

    bootstrapApplication(AppComponent, appConfig)
    .catch(error => console.error(error)); +
    const loggingConfig: LogServiceConfig = {
    loggers: [
    {
    loggerName: '',
    level: 'warn',
    appenderNames: [
    'console'
    ]
    }
    ],
    appenders: [
    {
    name: 'console',
    providerToken: CONSOLE_APPENDER_TOKEN,
    logFormat: `[${AppenderPlaceholders.Level}] ${AppenderPlaceholders.Logger} ${AppenderPlaceholders.Message}${AppenderPlaceholders.Error}`
    }
    ]
    };

    const appConfig = {
    providers: [
    ...
    { provide: CONSOLE_APPENDER_TOKEN, useClass: ConsoleAppender },
    { provide: LOG_SERVICE_CONFIG_TOKEN, useValue: loggingConfig }
    ]
    };

    bootstrapApplication(AppComponent, appConfig)
    .catch(error => console.error(error));

    Alternatively, you can use environment-specific configurations (see environment-specific configurations) which would allow you to log 'debug'-level statements in development, but only 'info'-level and above in production. Then you will just reference the appropriate section of your environment from within the application config:

    diff --git a/docs/enums/public_api.AppenderPlaceholders.html b/docs/enums/public_api.AppenderPlaceholders.html index e8bdeb5..4246488 100644 --- a/docs/enums/public_api.AppenderPlaceholders.html +++ b/docs/enums/public_api.AppenderPlaceholders.html @@ -1,6 +1,6 @@ AppenderPlaceholders | log4ngx

    Enumeration AppenderPlaceholders

    Placeholder constants for use in the AppenderConfig.logFormat and/or AppenderConfig.errorFormat properties.

    -

    Enumeration Members

    Enumeration Members

    Crlf Date Datetime Error @@ -17,22 +17,22 @@ Timestamp UtcDate

    Enumeration Members

    Crlf: "{crlf}"

    Carriage return/line feed characters, i.e. '\r\n'.

    -
    Date: "{date}"

    The log timestamp converted to the default date format, e.g. 'Mon Aug 07 2017'.

    -
    Datetime: "{datetime}"

    The log timestamp converted to locale-specific date/time format, e.g. '07/08/2017, 15:53:34'.

    -
    Error: "{error}"

    The logged error (if any), formatted according to AppenderConfig.errorFormat.

    -
    ErrorMessage: "{error-message}"

    The logged Error's message property.

    +
    Date: "{date}"

    The log timestamp converted to the default date format, e.g. 'Mon Aug 07 2017'.

    +
    Datetime: "{datetime}"

    The log timestamp converted to locale-specific date/time format, e.g. '07/08/2017, 15:53:34'.

    +
    Error: "{error}"

    The logged error (if any), formatted according to AppenderConfig.errorFormat.

    +
    ErrorMessage: "{error-message}"

    The logged Error's message property.

    Note that this placeholder is only valid within AppenderConfig.errorFormat.

    -
    ErrorName: "{error-name}"

    The logged Error's name property.

    +
    ErrorName: "{error-name}"

    The logged Error's name property.

    Note that this placeholder is only valid within AppenderConfig.errorFormat.

    -
    ErrorStack: "{error-stack}"

    The logged Error's stack property.

    +
    ErrorStack: "{error-stack}"

    The logged Error's stack property.

    Note that this placeholder is only valid within AppenderConfig.errorFormat.

    -
    IsoDate: "{date-iso}"

    The log timestamp converted to ISO format, e.g. '2017-08-07T14:53:34.329Z'.

    -
    Level: "{level}"

    The Level.displayName property.

    -
    Lf: "{lf}"

    Linefeed character, i.e. '\n'.

    -
    Logger: "{logger}"

    The Logger.name property.

    -
    Message: "{message}"

    The log message.

    -
    ShortDate: "{date-short}"

    The log timestamp converted to locale-specific date format, e.g. '07/08/2017'.

    -
    Time: "{time}"

    The log timestamp converted to locale-specific time format, e.g. '15:53:34'.

    -
    Timestamp: "{timestamp}"

    The log timestamp as a number.

    -
    UtcDate: "{date-utc}"

    The log timestamp converted to UTC format, e.g. 'Mon, 07 Aug 2017 14:53:34 GMT'.

    -
    +
    IsoDate: "{date-iso}"

    The log timestamp converted to ISO format, e.g. '2017-08-07T14:53:34.329Z'.

    +
    Level: "{level}"

    The Level.displayName property.

    +
    Lf: "{lf}"

    Linefeed character, i.e. '\n'.

    +
    Logger: "{logger}"

    The Logger.name property.

    +
    Message: "{message}"

    The log message.

    +
    ShortDate: "{date-short}"

    The log timestamp converted to locale-specific date format, e.g. '07/08/2017'.

    +
    Time: "{time}"

    The log timestamp converted to locale-specific time format, e.g. '15:53:34'.

    +
    Timestamp: "{timestamp}"

    The log timestamp as a number.

    +
    UtcDate: "{date-utc}"

    The log timestamp converted to UTC format, e.g. 'Mon, 07 Aug 2017 14:53:34 GMT'.

    +
    diff --git a/docs/index.html b/docs/index.html index 78a9798..15ae990 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,33 +1,8 @@ -log4ngx

    log4ngx

    log4ngx

    log4ngx is a Typescript logging framework for Angular projects, based on concepts used in Log4j, Log4net, etc.

    +log4ngx

    log4ngx

    log4ngx

    log4ngx is a Typescript logging framework for Angular projects, based on concepts used in Log4j, +Log4net, etc.

    Loggers provide access to the methods for logging messages at the required Level. Each class - i.e. component, module or service - will usually define its own Logger which will identify that class within any messages logged via it.

    The LogService is the factory with which you instantiate Loggers in each of the components, services, etc, in which you wish to log messages. Behind the scenes, it also orchestrates the dispatch of messages from the Loggers to the appropriate Appenders.

    Appenders are responsible for sending log entries to the underlying target or service. Configuration will normally depend on the target/service, but all Appenders are configured with the layout format for messages logged to them.

    The LogService is configured using an instance of the LogServiceConfig, typically created in your application's main module. The configuration defines the parameters used with each Appender and how each Appender relates to the various Loggers.

    -

    For more information about using and configuring log4ngx, see https://secondbounce.github.io/log4ngx/.

    -
      -
    • Make sure all classes, interfaces and their public/protected methods are documented
    • -
    -
      -
    • Getting Started -
        -
      • installing
      • -
      • configuring
      • -
      • usage
      • -
      -
    • -
    • Customising -
        -
      • Writing a custom appender
      • -
      • Writing a custom level
      • -
      -
    • -
    • API -
        -
      • Classes
      • -
      • Interfaces
      • -
      • Constants
      • -
      • Utility
      • -
      -
    • -
    -
    +

    For more information about using and configuring log4ngx, see https://secondbounce.github.io/log4ngx/. The demo project (in the projects/demo/ folder of the repo) also contains examples of configuring and using the library.

    +
    diff --git a/docs/interfaces/public_api.AppenderConfig.html b/docs/interfaces/public_api.AppenderConfig.html index f90a267..b7e3f36 100644 --- a/docs/interfaces/public_api.AppenderConfig.html +++ b/docs/interfaces/public_api.AppenderConfig.html @@ -1,5 +1,5 @@ AppenderConfig | log4ngx

    Interface AppenderConfig

    Interface defining the basic configuration for all Appender classes.

    -
    interface AppenderConfig {
        errorFormat?: string;
        logFormat: string;
        name: string;
        providerToken: InjectionToken<Appender>;
    }

    Hierarchy (view full)

    Properties

    interface AppenderConfig {
        errorFormat?: string;
        logFormat: string;
        name: string;
        providerToken: InjectionToken<Appender>;
    }

    Hierarchy (view full)

    Properties

    errorFormat? logFormat name providerToken @@ -7,9 +7,9 @@ included with a log entry.

    The format string may include both string literals and AppenderPlaceholders which will be replaced with the corresponding value.

    -
    logFormat: string

    The string format for each log entry.

    +
    logFormat: string

    The string format for each log entry.

    The format string may include both string literals and AppenderPlaceholders which will be replaced with the corresponding value.

    -
    name: string

    The name of the appender configuration. This value is referenced in LoggerConfig.appenderNames.

    -
    providerToken: InjectionToken<Appender>

    The InjectionToken provided for the required Appender.

    -
    +
    name: string

    The name of the appender configuration. This value is referenced in LoggerConfig.appenderNames.

    +
    providerToken: InjectionToken<Appender>

    The InjectionToken provided for the required Appender.

    +
    diff --git a/docs/interfaces/public_api.ConsoleAppenderConfig.html b/docs/interfaces/public_api.ConsoleAppenderConfig.html index 2e6b27a..f60c310 100644 --- a/docs/interfaces/public_api.ConsoleAppenderConfig.html +++ b/docs/interfaces/public_api.ConsoleAppenderConfig.html @@ -1,5 +1,5 @@ ConsoleAppenderConfig | log4ngx

    Interface ConsoleAppenderConfig

    Interface defining the basic configuration for all Appender classes.

    -
    interface ConsoleAppenderConfig {
        errorFormat?: string;
        logFormat: string;
        name: string;
        providerToken: InjectionToken<Appender>;
    }

    Hierarchy (view full)

    Properties

    interface ConsoleAppenderConfig {
        errorFormat?: string;
        logFormat: string;
        name: string;
        providerToken: InjectionToken<Appender>;
    }

    Hierarchy (view full)

    Properties

    errorFormat? logFormat name providerToken @@ -7,9 +7,9 @@ included with a log entry.

    The format string may include both string literals and AppenderPlaceholders which will be replaced with the corresponding value.

    -
    logFormat: string

    The string format for each log entry.

    +
    logFormat: string

    The string format for each log entry.

    The format string may include both string literals and AppenderPlaceholders which will be replaced with the corresponding value.

    -
    name: string

    The name of the appender configuration. This value is referenced in LoggerConfig.appenderNames.

    -
    providerToken: InjectionToken<Appender>

    The InjectionToken provided for the required Appender.

    -
    +
    name: string

    The name of the appender configuration. This value is referenced in LoggerConfig.appenderNames.

    +
    providerToken: InjectionToken<Appender>

    The InjectionToken provided for the required Appender.

    +
    diff --git a/docs/interfaces/public_api.LocalStorageAppenderConfig.html b/docs/interfaces/public_api.LocalStorageAppenderConfig.html index 2df58ab..6c7e546 100644 --- a/docs/interfaces/public_api.LocalStorageAppenderConfig.html +++ b/docs/interfaces/public_api.LocalStorageAppenderConfig.html @@ -1,5 +1,5 @@ LocalStorageAppenderConfig | log4ngx

    Interface LocalStorageAppenderConfig

    Interface defining the configuration of LocalStorageAppender objects.

    -
    interface LocalStorageAppenderConfig {
        errorFormat?: string;
        keyPrefix?: string;
        logEntryDelimiter?: string;
        logFormat: string;
        maxDays?: number;
        name: string;
        providerToken: InjectionToken<Appender>;
    }

    Hierarchy (view full)

    Properties

    interface LocalStorageAppenderConfig {
        errorFormat?: string;
        keyPrefix?: string;
        logEntryDelimiter?: string;
        logFormat: string;
        maxDays?: number;
        name: string;
        providerToken: InjectionToken<Appender>;
    }

    Hierarchy (view full)

    Properties

    errorFormat? keyPrefix? logEntryDelimiter? logFormat @@ -10,12 +10,12 @@ included with a log entry.

    The format string may include both string literals and AppenderPlaceholders which will be replaced with the corresponding value.

    -
    keyPrefix?: string

    Defines the prefix used for the key when adding items to localStorage.

    -
    logEntryDelimiter?: string

    String value used as a delimiter between each log entry

    -
    logFormat: string

    The string format for each log entry.

    +
    keyPrefix?: string

    Defines the prefix used for the key when adding items to localStorage.

    +
    logEntryDelimiter?: string

    String value used as a delimiter between each log entry

    +
    logFormat: string

    The string format for each log entry.

    The format string may include both string literals and AppenderPlaceholders which will be replaced with the corresponding value.

    -
    maxDays?: number

    Maximum number of days' logs to be retained in localStorage

    -
    name: string

    The name of the appender configuration. This value is referenced in LoggerConfig.appenderNames.

    -
    providerToken: InjectionToken<Appender>

    The InjectionToken provided for the required Appender.

    -
    +
    maxDays?: number

    Maximum number of days' logs to be retained in localStorage

    +
    name: string

    The name of the appender configuration. This value is referenced in LoggerConfig.appenderNames.

    +
    providerToken: InjectionToken<Appender>

    The InjectionToken provided for the required Appender.

    +
    diff --git a/docs/interfaces/public_api.LogServiceConfig.html b/docs/interfaces/public_api.LogServiceConfig.html index 881dc4f..f53bcec 100644 --- a/docs/interfaces/public_api.LogServiceConfig.html +++ b/docs/interfaces/public_api.LogServiceConfig.html @@ -1,3 +1,3 @@ -LogServiceConfig | log4ngx

    Interface LogServiceConfig

    interface LogServiceConfig {
        appenders: AppenderConfig[];
        loggers: LoggerConfig[];
    }

    Properties

    appenders +LogServiceConfig | log4ngx

    Interface LogServiceConfig

    interface LogServiceConfig {
        appenders: AppenderConfig[];
        loggers: LoggerConfig[];
    }

    Properties

    Properties

    appenders: AppenderConfig[]
    loggers: LoggerConfig[]
    +

    Properties

    appenders: AppenderConfig[]
    loggers: LoggerConfig[]
    diff --git a/docs/interfaces/public_api.LoggerConfig.html b/docs/interfaces/public_api.LoggerConfig.html index 4d0e384..2f45c30 100644 --- a/docs/interfaces/public_api.LoggerConfig.html +++ b/docs/interfaces/public_api.LoggerConfig.html @@ -1,10 +1,10 @@ LoggerConfig | log4ngx

    Interface LoggerConfig

    Interface defining the configuration for each Logger instance.

    -
    interface LoggerConfig {
        appenderNames: string[];
        level: string;
        loggerName: string;
    }

    Properties

    interface LoggerConfig {
        appenderNames: string[];
        level: string;
        loggerName: string;
    }

    Properties

    appenderNames: string[]

    The name of each Appender that log entries will be sent to.

    -
    level: string

    The name of the lowest level to be logged.

    -
    loggerName: string

    The name of the Logger instance for which this configuration refers. If left blank, +

    level: string

    The name of the lowest level to be logged.

    +
    loggerName: string

    The name of the Logger instance for which this configuration refers. If left blank, this configuration will be used for all Logger instances that don't have a defined configuration.

    -
    +
    diff --git a/docs/modules/public_api.html b/docs/modules/public_api.html index 2a64bcb..733deff 100644 --- a/docs/modules/public_api.html +++ b/docs/modules/public_api.html @@ -1,10 +1,8 @@ -public-api | log4ngx

    Module public-api

    Index

    Enumerations

    AppenderPlaceholders +public-api | log4ngx

    Module public-api

    Index

    Enumerations

    Classes

    Appender ConsoleAppender -ConsoleService Level LocalStorageAppender -Log4ngxModule LogService Logger LoggingEvent diff --git a/docs/variables/public_api.CONSOLE_APPENDER_TOKEN.html b/docs/variables/public_api.CONSOLE_APPENDER_TOKEN.html index 4a1fa6f..0793e92 100644 --- a/docs/variables/public_api.CONSOLE_APPENDER_TOKEN.html +++ b/docs/variables/public_api.CONSOLE_APPENDER_TOKEN.html @@ -1,2 +1,2 @@ CONSOLE_APPENDER_TOKEN | log4ngx

    Variable CONSOLE_APPENDER_TOKENConst

    CONSOLE_APPENDER_TOKEN: InjectionToken<Appender> = ...

    The InjectionToken to be used when referencing the ConsoleAppender for DI.

    -
    +
    diff --git a/docs/variables/public_api.LOCALSTORAGE_APPENDER_TOKEN.html b/docs/variables/public_api.LOCALSTORAGE_APPENDER_TOKEN.html index 26ab1d7..4f816e0 100644 --- a/docs/variables/public_api.LOCALSTORAGE_APPENDER_TOKEN.html +++ b/docs/variables/public_api.LOCALSTORAGE_APPENDER_TOKEN.html @@ -1,2 +1,2 @@ LOCALSTORAGE_APPENDER_TOKEN | log4ngx

    Variable LOCALSTORAGE_APPENDER_TOKENConst

    LOCALSTORAGE_APPENDER_TOKEN: InjectionToken<Appender> = ...

    The InjectionToken to be used when referencing the LocalStorageAppender for DI.

    -
    +
    diff --git a/docs/variables/public_api.LOG_SERVICE_CONFIG_TOKEN.html b/docs/variables/public_api.LOG_SERVICE_CONFIG_TOKEN.html index dc195b0..f6f249c 100644 --- a/docs/variables/public_api.LOG_SERVICE_CONFIG_TOKEN.html +++ b/docs/variables/public_api.LOG_SERVICE_CONFIG_TOKEN.html @@ -1,2 +1,2 @@ LOG_SERVICE_CONFIG_TOKEN | log4ngx

    Variable LOG_SERVICE_CONFIG_TOKENConst

    LOG_SERVICE_CONFIG_TOKEN: InjectionToken<LogServiceConfig> = ...

    The InjectionToken to be used when referencing the LogServiceConfig for DI.

    -
    +
    diff --git a/package.json b/package.json index 77ffec3..de01ec1 100644 --- a/package.json +++ b/package.json @@ -6,14 +6,16 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/secondbounce/log4ngx.git" + "url": "git+https://github.com/secondbounce/log4ngx.git" }, "bugs": { "url": "https://github.com/secondbounce/log4ngx/issues" }, "keywords": [ "angular", - "log4", + "log", + "log4j", + "logger", "logging", "typescript" ], @@ -67,4 +69,4 @@ "typescript": "~5.4.5", "typescript-eslint": "^8.4.0" } -} \ No newline at end of file +} diff --git a/projects/log4ngx/LICENSE b/projects/log4ngx/LICENSE new file mode 100644 index 0000000..bb46ed3 --- /dev/null +++ b/projects/log4ngx/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023-24 Second Bounce Ltd + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/projects/log4ngx/README.md b/projects/log4ngx/README.md index 9520858..c79af28 100644 --- a/projects/log4ngx/README.md +++ b/projects/log4ngx/README.md @@ -1,6 +1,7 @@ # log4ngx -log4ngx is a Typescript logging framework for Angular projects, based on concepts used in Log4j, Log4net, etc. +log4ngx is a Typescript logging framework for Angular projects, based on concepts used in Log4j, +Log4net, etc. ## Concepts @@ -20,4 +21,4 @@ The `LogService` is the factory with which you instantiate `Loggers` in each of The `LogService` is configured using an instance of the `LogServiceConfig`, typically created in your application's main module. The configuration defines the parameters used with each `Appender` and how each `Appender` relates to the various `Loggers`. -For more information about using and configuring log4ngx, see . +For more information about using and configuring log4ngx, see . The demo project (in the _projects/demo/_ folder of the repo) also contains examples of configuring and using the library. diff --git a/projects/log4ngx/package.json b/projects/log4ngx/package.json index 619308a..ea06ffc 100644 --- a/projects/log4ngx/package.json +++ b/projects/log4ngx/package.json @@ -6,14 +6,16 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/secondbounce/log4ngx.git" + "url": "git+https://github.com/secondbounce/log4ngx.git" }, "bugs": { "url": "https://github.com/secondbounce/log4ngx/issues" }, "keywords": [ "angular", - "log4", + "log", + "log4j", + "logger", "logging", "typescript" ], @@ -24,4 +26,4 @@ "dependencies": { "tslib": "^2.6.3" } -} \ No newline at end of file +} diff --git a/projects/log4ngx/src/lib/log.service.ts b/projects/log4ngx/src/lib/log.service.ts index 2f5321c..b92fc44 100644 --- a/projects/log4ngx/src/lib/log.service.ts +++ b/projects/log4ngx/src/lib/log.service.ts @@ -7,6 +7,19 @@ import { Logger } from './logger'; import { LoggerConfig } from './logger-config'; import { LoggingEvent } from './logging-event'; +/** + * + * + * ``` typescript + * export class MyComponent { + * private readonly _log: Logger; + * + * constructor(logService: LogService) { + * this._log = logService.getLogger(this); + * } + * } + * ``` + */ @Injectable({ providedIn: 'root' }) @@ -45,6 +58,13 @@ export class LogService { } public getLogger(name: string): Logger; + /** + * + * @param instance + * + * IMPORTANT This overload should not be used if your build system minifies or otherwise mangles + * class names and you intend including the class name in your log output. + */ public getLogger(instance: object): Logger; public getLogger(nameOrObject: string | object): Logger { let name: string; diff --git a/projects/log4ngx/src/lib/logger.ts b/projects/log4ngx/src/lib/logger.ts index 0dfafc6..b8c3136 100644 --- a/projects/log4ngx/src/lib/logger.ts +++ b/projects/log4ngx/src/lib/logger.ts @@ -18,7 +18,7 @@ export class Logger { * `Logger` instances should **NOT** be instantiated directly using this constructor as the instance * will not be registered and cached within the {@link LogService}. (This will mean that every instance * of the parent class will end up with its own duplicate copy, rather than sharing a single instance.) - * Instead, use the {@link LogService.getLogger}, i.e. + * Instead, use the {@link LogService.getLogger}() method, i.e. * ``` * this._log = logService.getLogger('MyComponent'); * ```