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

Updated descriptions #12

Merged
merged 8 commits into from
Nov 27, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added section for creating handler in README.
  • Loading branch information
Giedrius Grabauskas committed Nov 27, 2017
commit f3993f4fe6f15f93ec385de1591cbb2f96c12ae9
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 61,25 @@ const logger = new LoggerBuilder({
});
```

### Creating logger handler

```ts
import { MessageHandlerBase, LogLevel, LoggerBuilder, LoggerConfigurationBuilder } from "simplr-logger";

class MyMessageHandler extends MessageHandlerBase {
public HandleMessage(level: LogLevel, timestamp: number, messages: any[]): void {
console.log(...messages);
}
}

const config = new LoggerConfigurationBuilder()
.AddWriteMessageHandler({ Handler: new MyMessageHandler(), LogLevel: LogLevel.Trace })
.Build();

const logger = new LoggerBuilder(config);

```

### Using logger

#### Logging with methods
Expand Down